|
18 | 18 | """
|
19 | 19 |
|
20 | 20 | ################################################################################################################
|
21 |
| -# Example 1: Spatial dataset plot arguments |
22 |
| -# ----------------------------------------- |
| 21 | +# |
| 22 | +# .. _tutorial-plot-customizations-ex1: |
| 23 | +# |
| 24 | +# Example 1: Customizing Gridded Dataset Plot |
| 25 | +# ------------------------------------------- |
23 | 26 |
|
24 | 27 | ####################################################################################################################################
|
25 | 28 | # **Load required libraries**
|
|
49 | 52 | # * Assign a title
|
50 | 53 | # * Set labels to the geographic axes
|
51 | 54 | # * Draw country borders
|
52 |
| -# * Set a linewidth of 0.5 to country border |
53 |
| -# * Assign ``'rainbow'`` as the colormap. Possible values from ``matplotlib.cm`` library |
| 55 | +# * Set a linewidth of 1.5 to country border |
| 56 | +# * Assign ``'rainbow'`` as the colormap. Possible values from :mod:`matplotlib.cm` library |
54 | 57 | # * Defines 0.8 for an exponential transparency function (default is 0 for constant alpha, whereas 1 for linear).
|
55 |
| -# * An object cartopy.crs.Projection() is passed as Projection to the map |
| 58 | +# * An object :class:`cartopy.crs.Projection` (in this case :class:`cartopy.crs.Mercator`) is passed to the map |
56 | 59 | #
|
57 | 60 | # The complete description of plot arguments can be found in :func:`csep.utils.plots.plot_gridded_dataset`
|
58 | 61 | #
|
|
70 | 73 | show=True)
|
71 | 74 |
|
72 | 75 | ####################################################################################################################################
|
| 76 | +# |
| 77 | +# .. _tutorial-plot-customizations-ex2: |
| 78 | +# |
73 | 79 | # Example 2: Plot a global forecast and a selected magnitude bin range
|
74 | 80 | # --------------------------------------------------------------------
|
75 | 81 | #
|
|
105 | 111 | ####################################################################################################################################
|
106 | 112 | # **Plotting the dataset**
|
107 | 113 | #
|
108 |
| -# To plot a global forecast, we must assign the option ``set_global=True``, which is required by :ref:`cartopy` to handle |
| 114 | +# To plot a global forecast, we must assign the option ``set_global=True``, which is required by :mod:`cartopy` to handle |
109 | 115 | # internally the extent of the plot. We can further customize the plot using the required arguments from :func:`~csep.utils.plots.plot_gridded_dataset`
|
110 | 116 | #
|
111 | 117 |
|
|
131 | 137 |
|
132 | 138 |
|
133 | 139 | ####################################################################################################################################
|
| 140 | +# |
| 141 | +# .. _tutorial-plot-customizations-ex3: |
| 142 | +# |
134 | 143 | # Example 3: Plot a catalog with a custom basemap
|
135 | 144 | # -----------------------------------------------
|
136 | 145 |
|
|
178 | 187 |
|
179 | 188 | ax = catalog.plot(show=True, **plot_args)
|
180 | 189 |
|
| 190 | +#################################################################################################################################### |
| 191 | +# Alternatively, it can be plotted using the :func:`csep.utils.plots.plot_catalog` function |
| 192 | + |
| 193 | +plots.plot_catalog(catalog=catalog, show=True, **plot_args) |
181 | 194 |
|
182 | 195 | ####################################################################################################################################
|
| 196 | +# |
| 197 | +# .. _tutorial-plot-customizations-ex4: |
| 198 | +# |
183 | 199 | # Example 4: Plot composition
|
184 | 200 | # -----------------------------------------------
|
185 | 201 | #
|
|
205 | 221 | # Plot the basemap alone by using :func:`csep.utils.plots.plot_basemap`. Do not set ``show=True`` and store the returned ``ax`` object to
|
206 | 222 | # start the composite plot
|
207 | 223 |
|
| 224 | +# Start the base plot |
208 | 225 | ax = plots.plot_basemap(figsize=(8, 8),
|
209 | 226 | projection=cartopy.crs.AlbersEqualArea(central_longitude=-120.),
|
210 | 227 | extent=forecast.region.get_bbox(),
|
|
217 | 234 | ax = forecast.plot(colormap='PuBu_r', alpha_exp=0.5, ax=ax)
|
218 | 235 |
|
219 | 236 | # Use show=True to finalize the composite.
|
220 |
| -catalog.plot(markercolor='darkred', ax=ax, show=True) |
| 237 | +plots.plot_catalog(catalog=catalog, markercolor='darkred', ax=ax, show=True) |
221 | 238 |
|
222 | 239 | ####################################################################################################################################
|
| 240 | +# |
| 241 | +# .. _tutorial-plot-customizations-ex5: |
| 242 | +# |
223 | 243 | # Example 5: Plot multiple evaluation results
|
224 | 244 | # -------------------------------------------
|
225 | 245 |
|
|
0 commit comments