Plotters¶
Utilities for plotting quantities computed in active subspaces.
-
active_subspaces.utils.plotters.
eigenvalues
(e, e_br=None, out_label=None, opts=None)¶ Plot the eigenvalues with bootstrap ranges.
Parameters: - e (ndarray) – k-by-1 matrix that contains the estimated eigenvalues
- e_br (ndarray, optional) – lower and upper bounds for the estimated eigenvalues. These are typically computed with a bootstrap. (default None)
- out_label (str, optional) – a label for the quantity of interest (default None)
- opts (dict, optional) – a dictionary with some plot options (default None)
See also
utils.plotters.eigenvectors()
,utils.plotters.subspace_errors()
-
active_subspaces.utils.plotters.
eigenvectors
(W, W_br=None, in_labels=None, out_label=None, opts=None)¶ Plot the estimated eigenvectors with optional bootstrap ranges.
Parameters: - W (ndarray) – m-by-k matrix that contains k of the estimated eigenvectors from the active subspace analysis.
- W_br (ndarray, optional) – m-by-(2*k) matrix that contains estimated upper and lower bounds on the components of the eigenvectors (default None)
- in_labels (str[], optional) – list of labels for the simulation’s inputs (default None)
- out_label (str, optional) – a label for the quantity of interest (default None)
- opts (dict, optional) – a dictionary with some plot options (default None)
See also
utils.plotters.subspace_errors()
,utils.plotters.eigenvalues()
Notes
This function will plot at most the first four eigevectors in a four-subplot figure. In other words, it only looks at the first four columns of W.
-
active_subspaces.utils.plotters.
plot_opts
(savefigs=True, figtype='.eps')¶ A few options for the plots.
Parameters: - savefigs (bool) – save figures into a separate figs director
- figtype (str) – a file extention for the type of image to save
Returns: opts – the chosen options. The keys in the dictionary are figtype, savefigs, and font. The font is a dictionary that sets the font properties of the figures.
Return type: dict
-
active_subspaces.utils.plotters.
subspace_errors
(sub_br, out_label=None, opts=None)¶ Plot the estimated subspace errors with bootstrap ranges.
Parameters: - sub_br (ndarray) – (k-1)-by-3 matix that contains the lower bound, mean, and upper bound of the subspace errors for each dimension of subspace.
- out_label (str, optional) – a label for the quantity of interest (default None)
- opts (dict, optional) – a dictionary with some plot options (default None)
See also
utils.plotters.eigenvectors()
,utils.plotters.eigenvalues()
-
active_subspaces.utils.plotters.
sufficient_summary
(y, f, out_label=None, opts=None)¶ Make a summary plot with the given predictors and responses.
Parameters: - y (ndarray) – M-by-1 or M-by-2 matrix that contains the values of the predictors for the summary plot.
- f (ndarray) – M-by-1 matrix that contains the corresponding responses
- out_label (str, optional) – a label for the quantity of interest (default None)
- opts (dict, optional) – a dictionary with some plot options (default None)
Notes
If y.shape[1] is 1, then this function produces only the univariate summary plot. If y.shape[1] is 2, then this function produces both the univariate and the bivariate summary plot, where the latter is a scatter plot with the first column of y on the horizontal axis, the second column of y on the vertical axis, and the color corresponding to f.
-
active_subspaces.utils.plotters.
zonotope_2d_plot
(vertices, design=None, y=None, f=None, out_label=None, opts=None)¶ A utility for plotting (m,2) zonotopes with designs and quadrature rules.
Parameters: - vertices (ndarray) – M-by-2 matrix that contains the vertices that define the zonotope
- design (ndarray, optional) – N-by-2 matrix that contains a design-of-experiments on the zonotope. The plot will contain the Delaunay triangulation of the points in design and vertices. (default None)
- y (ndarray, optional) – K-by-2 matrix that contains points to be plotted inside the zonotope. If y is given, then f must be given, too. (default None)
- f (ndarray, optional) – K-by-1 matrix that contains a color value for the associated points in y. This is useful for plotting function values or quadrature rules with the zonotope. If f is given, then y must be given, too. (default None)
- out_label (str, optional) – a label for the quantity of interest (default None)
- opts (dict, optional) – a dictionary with some plot options (default None)
Notes
This function makes use of the scipy.spatial routines for plotting the zonotopes.