Skip to content

Commit 2691064

Browse files
committed
add description about plot types
1 parent 807dc2a commit 2691064

1 file changed

Lines changed: 82 additions & 48 deletions

File tree

docs/user-guide.rst

Lines changed: 82 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ User guide
88
Starting the GUI
99
----------------
1010

11-
Assuming that you :ref:`installed <install>` psy-view, you can start it by
11+
Assuming that you :ref:`installed <install>` psy-view, you can start it by
1212
typing::
1313

1414
$ psy-view
1515

16-
in the terminal (or Anaconda Prompt on Windows). On windows you additionally
17-
have the opportunity to start it from the start menu (just search for
16+
in the terminal (or Anaconda Prompt on Windows). On windows you additionally
17+
have the opportunity to start it from the start menu (just search for
1818
psy-view), assuming that you have :ref:`installed it via conda <install-conda>`.
1919

2020
You can also directly pass a path to a netCDF file, e.g.::
@@ -49,8 +49,8 @@ in the terminal.
4949
The GUI
5050
-------
5151

52-
The usage of psy-view should be quite intuitive and this small guide gives you
53-
a quick intro into the central elements. Please let us know if you
52+
The usage of psy-view should be quite intuitive and this small guide gives you
53+
a quick intro into the central elements. Please let us know if you
5454
encounter any problems.
5555

5656
.. screenshot-figure:: ds_widget docs-ds_widget.png
@@ -63,8 +63,8 @@ application, or within the psyplot gui (see :ref:`psyplot-gui-embed`).
6363

6464
Resizing the GUI elements
6565
^^^^^^^^^^^^^^^^^^^^^^^^^
66-
The widget is made flexible such that you can adapt the heights of the
67-
individual elements. Just move your cursor between the elements to change their
66+
The widget is made flexible such that you can adapt the heights of the
67+
individual elements. Just move your cursor between the elements to change their
6868
size.
6969

7070
.. only:: html
@@ -82,9 +82,9 @@ Open a netCDF file
8282

8383
.. screenshot:: ds_widget.open_widget docs-open_widget.png
8484

85-
Click the |btn_open| button to select a netCDF file from the disk, or directly
86-
enter the path in the line widget. You can open multiple datasets at the
87-
same time within the widget. The selection of the current dataset can be
85+
Click the |btn_open| button to select a netCDF file from the disk, or directly
86+
enter the path in the line widget. You can open multiple datasets at the
87+
same time within the widget. The selection of the current dataset can be
8888
done through the dataset tree (see below)
8989

9090

@@ -99,8 +99,8 @@ View the dataset
9999

100100
.. screenshot:: ds_widget.ds_tree docs-ds_tree.png
101101

102-
Here you can see all open datasets and select the one you want to
103-
visualize. Expand the items to get more information about variables and
102+
Here you can see all open datasets and select the one you want to
103+
visualize. Expand the items to get more information about variables and
104104
their attributes.
105105

106106
.. _user-guide-navigation:
@@ -111,13 +111,13 @@ Navigate and export
111111
.. screenshot:: ds_widget.navigation_box.parentWidget() docs-navigation.png
112112
:plot:
113113

114-
In the top row, you can increase or decrease the dimension of the plotted variable.
114+
In the top row, you can increase or decrease the dimension of the plotted variable.
115115
Clicking |btn_prev| (or |btn_next|) decreases (or increases) the selected
116116
dimension, whereas |btn_animate_backward| and |btn_animate_forward| makes an
117-
animation. You can control the speed (i.e. frames per second) of the
117+
animation. You can control the speed (i.e. frames per second) of the
118118
animation via the slider next to the control |sl_interval| |lbl_interval|
119119

120-
The |btn_export| menu allows you to export your plots as images files,
120+
The |btn_export| menu allows you to export your plots as images files,
121121
animations or to export the plot settings for later usage. The |btn_preset|
122122
button lets you select custom presets for your plots (see the
123123
:ref:`psyplot docs <psyplot:presets>`).
@@ -163,14 +163,14 @@ Select the active plot
163163
.. screenshot:: ds_widget.array_frame docs-array_frame.png
164164
:plot:
165165

166-
The next section let's you switch between the different open plots. Once you
167-
have created a new plot with one of the variable buttons (see
168-
:ref:`below <user-guide-variables>`), you can
166+
The next section let's you switch between the different open plots. Once you
167+
have created a new plot with one of the variable buttons (see
168+
:ref:`below <user-guide-variables>`), you can
169169

170-
- create additional plots by clicking the |btn_add| button. This will open a
170+
- create additional plots by clicking the |btn_add| button. This will open a
171171
dialog to select a variable which is then plotted with the current plotmethod
172172
- close existing plots by clicking the |btn_del| button.
173-
- switch between the plots using the combo box |combo_array| which allows you
173+
- switch between the plots using the combo box |combo_array| which allows you
174174
to change the appearence of a different plot.
175175

176176
.. |btn_add| screenshot:: ds_widget.btn_add docs-btn_add.png
@@ -197,10 +197,11 @@ Select the plot method
197197
psy-view (currently) supports three of the psyplot plot methods.
198198

199199
- :attr:`~psy_simple:psyplot.project.plot.plot2d` for 2D scalar fields
200-
(rectilinear or unstructured)
201-
- :attr:`~psy_maps:psyplot.project.plot.mapplot` for **georeferenced** 2D scalar
202-
fields (rectilinear or unstructured)
203-
- :attr:`~psy_simple:psyplot.project.plot.lineplot` for 1D lines
200+
(rectilinear or unstructured, see the section :ref:`user-guide-plot2d`)
201+
- :attr:`~psy_maps:psyplot.project.plot.mapplot` for **georeferenced** 2D scalar
202+
fields (rectilinear or unstructured, see the section :ref:`user-guide-mapplot`)
203+
- :attr:`~psy_simple:psyplot.project.plot.lineplot` for 1D lines (see the
204+
section , see the section :ref:`user-guide-lineplot`)
204205

205206
.. _user-guide-mapplot:
206207

@@ -212,7 +213,7 @@ mapplot
212213

213214
In [1]: import psyplot.project as psy
214215
...: with psy.plot.mapplot(
215-
...: "demo.nc", name="t2m",
216+
...: "demo.nc", name="t2m",
216217
...: cmap="viridis", xgrid=False, ygrid=False,
217218
...: ) as sp:
218219
...: sp.export("docs-mapplot-example.png")
@@ -227,14 +228,43 @@ mapplot
227228
For georeferenced 2D-scalar fields (or more than 2D), you have the following
228229
options:
229230

230-
- clicking on a grid cell in the plot generates a line plot of the variable at
231-
that location (as you know it from ncview). The x-axis is determined by the
231+
- clicking on a grid cell in the plot generates a line plot of the variable at
232+
that location (as you know it from ncview). The x-axis is determined by the
232233
dimension you chose in the navigation (see :ref:`user-guide-navigation`).
233234
- the colormap button |btn_cmap| changes the colormap to another preset
234235
- the |btn_cmap_settings| button opens a dialog for more advanced color settings
235236
- the |btn_proj| button switches to other projections for the basemap
236-
- the |btn_proj_settings| button opens a dialog for formatting the background
237+
- the |btn_proj_settings| button opens a dialog for formatting the background
237238
(meridionals, parallels, land color, ocean color, coastlines, etc.)
239+
- the :guilabel:`Plot type` menu |combo_plot| let's you select the type of
240+
plotting. You can choose one of the following options
241+
242+
Default
243+
This mode uses an efficient algorithm for regular lat-lon meshes (using
244+
matplotlibs :func:`~matplotlib.pyplot.pcolormesh` function), or an
245+
explicit drawing of the individual grid cell polygons for unstructured
246+
grids (see `Gridcell polygons` below). These two methods draw each grid
247+
cells explicitly. Gridcell boundaries are thereby extracted following the
248+
CF (or UGRID)-Conventions. If this is not possible, they are interpolated
249+
from the gridcell coordinates.
250+
Filled contours
251+
Different from the `Default` method this is not visualizing each cell
252+
individually, but instead plots the contours using matplotlibs
253+
:func:`~matplotlib.pyplot.contourf` function.
254+
Contours
255+
Similar to `Filled contours`, but we only draw the outlines of the contour
256+
areas using matplotlibs :func:`~matplotlib.pyplot.contour` function.
257+
Gridcell polygons
258+
This mode (which is the default for unstructured grids (not curvilinear
259+
grids) draws each grid cell individually using a variant of matplotlibs
260+
:func:`~matplotlib.pyplot.pcolor` function
261+
Disable
262+
Make no plotting at all. This can be useful if you want to display the
263+
datagrid only (see next point)
264+
265+
More information on the plot options can be found in the docs of the
266+
:attr:`~psy_maps.plotters.FieldPlotter.plot` formatoption.
267+
238268
- the |btn_datagrid| toggles the visibility of grid cell boundaries
239269
- the |btn_labels| button opens a dialog to edit colorbar labels, titles, etc.
240270

@@ -243,13 +273,13 @@ Furthermore you have a couple of dropdowns:
243273
x- and y-dimension
244274
This is the dimension in the netCDF variable that represents the longitudinal
245275
(latitudinal) dimension.
246-
x- and y-coordinate
276+
x- and y-coordinate
247277
This is the coordinate in the netCDF file that is used for the finally to
248278
visualize the data (equivalent to the `CF-conventions coordinates attribute`_
249279
of a netCDF variable.)
250280

251281
psyplot automatically decodes the variable and sets x- and y-dimension, as well
252-
as the appropriate coordinate. These dropdowns, however, let you modify the
282+
as the appropriate coordinate. These dropdowns, however, let you modify the
253283
automatic choice of psyplot.
254284

255285
.. _CF-conventions coordinates attribute: http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#coordinate-types
@@ -270,6 +300,10 @@ automatic choice of psyplot.
270300
:width: 1.3em
271301
:plot:
272302

303+
.. |combo_plot| screenshot:: ds_widget.plotmethod_widget.combo_plot docs-mapplot-combo_plot.png
304+
:height: 1.3em
305+
:plot:
306+
273307
.. |btn_datagrid| screenshot:: ds_widget.plotmethod_widget.btn_datagrid docs-mapplot-btn_datagrid.png
274308
:height: 1.3em
275309
:plot:
@@ -289,7 +323,7 @@ plot2d
289323

290324
In [1]: import psyplot.project as psy
291325
...: with psy.plot.plot2d(
292-
...: "demo.nc", name="t2m",
326+
...: "demo.nc", name="t2m",
293327
...: cmap="viridis",
294328
...: ) as sp:
295329
...: sp.export("docs-plot2d-example.png")
@@ -300,7 +334,7 @@ plot2d
300334
:plot:
301335
:plotmethod: plot2d
302336

303-
Simple 2D plots are also possible for variables with 2 dimensions and more (or
337+
Simple 2D plots are also possible for variables with 2 dimensions and more (or
304338
scalar fields on an unstructured grid). The options are the same as for
305339
:ref:`mapplot <user-guide-mapplot>`, but for obvious reasons there are no
306340
projection and basemap settings.
@@ -343,7 +377,7 @@ following functionalities:
343377

344378
.. note::
345379

346-
Changing the variable (see :ref:`user-guide-variables`) or the
380+
Changing the variable (see :ref:`user-guide-variables`) or the
347381
dimensions (see :ref:`user-guide-dimensions`) only affects the current
348382
line that you can select with the |combo_lines| dropdown.
349383

@@ -377,18 +411,18 @@ Select the variables
377411

378412
.. screenshot:: ds_widget.variable_frame docs-variable_frame.png
379413

380-
The next section in the GUI shows the variables in the active dataset (note that
381-
you can switch to another dataset using the dataset tree, see
414+
The next section in the GUI shows the variables in the active dataset (note that
415+
you can switch to another dataset using the dataset tree, see
382416
:ref:`above <user-guide-ds_tree>`).
383417

384-
Click on a variable to make a plot. If there is already a plot of a variable in
418+
Click on a variable to make a plot. If there is already a plot of a variable in
385419
the dataset, it will be updated to show the new data.
386420

387-
.. note::
421+
.. note::
388422

389-
The variable buttons will make new plots, if there is None already, or
423+
The variable buttons will make new plots, if there is None already, or
390424
update the variable in the current plot. If you want to visualize two plots
391-
at the same time, use the |btn_add| button (see the
425+
at the same time, use the |btn_add| button (see the
392426
:ref:`plot selection above <user-guide-select-plot>`).
393427

394428

@@ -421,21 +455,21 @@ right-click decreases the dimension.
421455
Navigation inside the plot
422456
--------------------------
423457

424-
psy-view uses matplotlib for the visualization which comes with an interactive
425-
backend to navigate inside the plot.
458+
psy-view uses matplotlib for the visualization which comes with an interactive
459+
backend to navigate inside the plot.
426460

427461
.. screenshot:: ds_widget.plotter.ax.figure.canvas.manager.toolbar docs-mpl-toolbar.png
428462
:plot:
429463

430-
Especially the Pan/Zoom button |btn_mpl_pan| and the zoom-to-rectangle button
431-
|btn_mpl_zoom| are of interest for you. You can enable and disable them by
464+
Especially the Pan/Zoom button |btn_mpl_pan| and the zoom-to-rectangle button
465+
|btn_mpl_zoom| are of interest for you. You can enable and disable them by
432466
clicking on the corresponding button in the toolbar.
433467

434468
.. warning::
435469

436470
In principal you can also edit the colormap using the |btn_mpl_settings|
437-
button from the toolbar. But this is known to cause errors for the mapplot
438-
method (see `#25`_), so you should use the corresponding widgets from the gui (see
471+
button from the toolbar. But this is known to cause errors for the mapplot
472+
method (see `#25`_), so you should use the corresponding widgets from the gui (see
439473
:ref:`user-guide-mapplot`).
440474

441475
.. screenshot:: ds_widget.plotter.ax.figure.canvas.manager.toolbar.actions()[4].associatedWidgets()[1] docs-btn_mpl_pan.png
@@ -495,12 +529,12 @@ More information can be found in the `matplotlib documentation`_.
495529

496530
Using psy-view within the psyplot GUI
497531
-------------------------------------
498-
psy-view is also available from the psyplot GUI. Just type ``psyplot`` in the
532+
psy-view is also available from the psyplot GUI. Just type ``psyplot`` in the
499533
terminal to start it. The only difference is that the available plots (see
500534
:ref:`user-guide-select-plot`) are managed through the current main project
501-
(:func:`psyplot.project.gcp`, see also the psyplot GUIs
535+
(:func:`psyplot.project.gcp`, see also the psyplot GUIs
502536
:ref:`project content <psyplot_gui:project-content>`), also accessible through
503-
the ``mp`` variable in the
537+
the ``mp`` variable in the
504538
:ref:`integrated IPython console <psyplot_gui:console>`. This gives you extra
505539
power as you now cannot only change your plots through the intuitive psy-view
506540
interface, but also from the command line or through the more flexible

0 commit comments

Comments
 (0)