You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/sme_contrib/plot.py
+29-57
Original file line number
Diff line number
Diff line change
@@ -139,40 +139,22 @@ def facet_grid_3D(
139
139
plotfuncs_kwargs: dict[str, dict[str, Any]] = {},
140
140
) ->pv.Plotter:
141
141
"""
142
-
Create a 3D facet plot using PyVista. This follows the seaborn.FacetGrid concept. This function creates a grid of subplots where each subplot is filled by a function in the plotfuncs argument. The keys for plotfuncs and data must be the same, such that plotfuncs can be unambiguously mapped over the data dictionary.
143
-
Do not attempt to plot 2D images and 3D images into the same facet grid, as this will create odd artifacts and
144
-
may not work as expected.
145
-
Parameters:
146
-
-----------
147
-
data : dict[str, np.ndarray]
148
-
A dictionary where keys are labels and values are numpy arrays containing the data to be plotted.
149
-
plotfuncs : dict[str, Callable]
150
-
A dictionary where keys are labels and values are functions with signature f(
Additional keyword arguments to pass to each plotting function.
142
+
Create a 3D facet plot using PyVista.
143
+
144
+
This follows the seaborn.FacetGrid concept. This function creates a grid of subplots where each subplot is filled by a function in the plotfuncs argument. The keys for plotfuncs and data must be the same, such that plotfuncs can be unambiguously mapped over the data dictionary. Do not attempt to plot 2D images and 3D images into the same facet grid, as this will create odd artifacts and may not work as expected.
145
+
146
+
Args:
147
+
data : dict[str, np.ndarray] A dictionary where keys are labels and values are numpy arrays containing the data to be plotted.
148
+
plotfuncs : dict[str, Callable] A dictionary where keys are labels and values are functions with signature f(label:str, data:np.ndarray | pyvista.ImageData | pyvista.UniformGrid, plotter:pv.Plotter, panel:tuple[int, int], show_cmap:bool=show_cmap, cmap=cmap, **plotfuncs_kwargs ) -> None
149
+
show_cmap : bool, optional Whether to show the color map. Default is False.
150
+
cmap : str | np.ndarray | pv.LookupTable, optional The color map to use. Default is "viridis".
151
+
portrait : bool, optional Whether to use a portrait layout. Default is False.
152
+
linked_views : bool, optional Whether to link the views of the subplots. Default is True.
153
+
plotter_kwargs : dict, optional Additional keyword arguments to pass to the PyVista Plotter.
154
+
plotfuncs_kwargs : dict[str, dict[str, Any]], optional Additional keyword arguments to pass to each plotting function.
171
155
172
156
Returns:
173
-
--------
174
-
pv.Plotter
175
-
The PyVista Plotter object with the created facet plot.
157
+
pv.Plotter The PyVista Plotter object with the created facet plot.
176
158
"""
177
159
ifdata.keys() !=plotfuncs.keys():
178
160
raiseValueError(
@@ -218,33 +200,23 @@ def facet_grid_animate_3D(
218
200
) ->str:
219
201
"""
220
202
Create a 3D animation from a series of data snapshots using PyVista.
203
+
221
204
This series must be a list of dictionaries with the data for each frame keyed by a label used to title the panel it will be plotted into. The final plot will have as many subplots as there are labels in the data dictionaries. The keys for plotfuncs and data must be the same.
222
-
Parameters:
223
-
-----------
224
-
filename : str
225
-
The name of the output movie file.
226
-
data : list[dict[str, np.ndarray]]
227
-
A list of dictionaries containing the data for each timestep.
228
-
plotfuncs : dict[str, Callable]
229
-
A dictionary of plotting functions keyed by data label. The keys for plotfuncs and data must be the same.
Additional keyword arguments to pass to each plotting function (default is an empty dictionary).
205
+
206
+
Args:
207
+
filename : str The name of the output movie file.
208
+
data : list[dict[str, np.ndarray]] A list of dictionaries containing the data for each timestep.
209
+
plotfuncs : dict[str, Callable] A dictionary of plotting functions keyed by data label. The keys for plotfuncs and data must be the same.
210
+
show_cmap : bool, optional Whether to show the color map (default is False).
211
+
cmap : str | np.ndarray | pv.LookupTable, optional The colormap to use (default is "viridis").
212
+
portrait : bool, optional Whether to use portrait layout (default is False).
213
+
linked_views : bool, optional Whether to link the views of the subplots (default is True).
214
+
titles : list[dict[str, str]], optional A list of dictionaries containing titles for each subplot (default is an empty list).
215
+
plotter_kwargs : dict, optional Additional keyword arguments to pass to the PyVista Plotter (default is an empty dictionary).
216
+
plotfuncs_kwargs : dict[str, dict[str, Any]], optional Additional keyword arguments to pass to each plotting function (default is an empty dictionary).
Create a discrete colormap for use with PyVista with as many colors as unique values in the `values`array based on a given matplotlbit colormap. The colors will possibly repeat if there are more unique values than colors in the colormap. In this case, the outcome is intended, e.g., for separability of regions in the visualization,
28
+
Create a discrete colormap for use with PyVista with as many colors as unique values in the ``values``array based on a given matplotlbit colormap. The colors will possibly repeat if there are more unique values than colors in the colormap. In this case, the outcome is intended, e.g., for separability of regions in the visualization,
29
29
30
30
Parameters:
31
31
cmap (str): The name of the colormap to use. Default is 'tab10'.
0 commit comments