|
32 | 32 | # To change the axes projection, pass ``proj='name'`` to an axes-creation command |
33 | 33 | # (i.e., `~proplot.figure.Figure.add_subplot`, `~proplot.figure.Figure.add_subplots`, |
34 | 34 | # `~proplot.figure.Figure.subplot`, or `~proplot.figure.Figure.subplots`). To use |
35 | | -# different projections for different subplots when creating them all at once, |
36 | | -# pass either a list of projection names or a dictionary of projection names |
37 | | -# with the subplot number as the key. For example, a 2-column figure with a |
38 | | -# Cartesian axes on the left and a Plate Carrée projection on the right can be |
39 | | -# built with either ``proj=('cartesian', 'pcarree')`` or ``proj={2: 'pcarree'}``. |
40 | | -# The default projection is `~proplot.axes.CartesianAxes`, optionally specified |
41 | | -# with the key ``'cartesian'``. |
| 35 | +# different projections for different subplots when creating your subplots al |
| 36 | +# at once with `~proplot.figure.Figure.subplots`, pass either a list of projection |
| 37 | +# names or a dictionary of projection names with the subplot number as the key. |
| 38 | +# For example, a 2-column figure with a Cartesian axes on the left and a Plate Carrée |
| 39 | +# projection on the right can be built with either ``proj=('cartesian', 'pcarree')`` |
| 40 | +# or ``proj={2: 'pcarree'}``. The default projection is `~proplot.axes.CartesianAxes`, |
| 41 | +# optionally specified with the key ``'cartesian'``. |
42 | 42 |
|
43 | 43 | # %% [raw] raw_mimetype="text/restructuredtext" |
44 | 44 | # .. _ug_geo: |
45 | 45 | # |
46 | 46 | # Geographic axes |
47 | 47 | # --------------- |
48 | | -# |
49 | | -# To create geographic axes, pass e.g. ``proj='name'`` to an axes-creation |
50 | | -# command (see :ref:`above <ug_proj>`) where ``name`` is any valid |
| 48 | + |
| 49 | +# To create geographic axes, pass e.g. ``proj='name'`` to an |
| 50 | +# axes-creation command (see :ref:`above <ug_proj>`) where ``name`` is any valid |
51 | 51 | # :ref:`PROJ projection name <proj_included>`. Alternatively, you can use |
52 | | -# ``proj=projection_instance`` where ``projection_instance`` is a |
53 | | -# `cartopy.crs.Projection` or `mpl_toolkits.basemap.Basemap` generated with |
54 | | -# the `~proplot.constructor.Proj` :ref:`constructor function <why_constructor>`. |
55 | | -# A very simple geographic plot is shown below. |
| 52 | +# ``proj=projection_instance`` where ``projection_instance`` is an object returned |
| 53 | +# by the `~proplot.constructor.Proj` :ref:`constructor function <why_constructor>` |
| 54 | +# (see below for details). Requesting geographic projections returns |
| 55 | +# `~proplot.axes.GeoAxes` instance(s) with their own `~proplot.axes.GeoAxes.format` |
| 56 | +# command. `proplot.axes.GeoAxes.format` facilitates :ref:`geographic-specific |
| 57 | +# modifications <ug_geoformat>` like meridional and parallel gridlines and land |
| 58 | +# mass outlines. The syntax is very similar to `proplot.axes.CartesianAxes.format`. |
| 59 | +# In the below example, we create and format a very simple geographic plot. |
56 | 60 |
|
57 | 61 | # %% |
58 | 62 | # Option A: Create a projection with pplt.Proj() |
|
75 | 79 | # Cartopy and basemap |
76 | 80 | # ------------------- |
77 | 81 | # |
78 | | -# Geographic axes in ProPlot use either `cartopy`_ or `basemap`_ as "backends". |
79 | | -# When you request a geographic projection, the axes-creation command returns |
80 | | -# a `proplot.axes.GeoAxes` instance(s) that uses either cartopy or basemap |
81 | | -# under the hood. The `proplot.axes.GeoAxes` subclass has its own |
82 | | -# `~proplot.axes.GeoAxes.format` command that :ref:`manages geographic features |
83 | | -# <ug_geoformat>` like meridional and parallel gridlines and land mass outlines |
84 | | -# with the same syntax for either backend. A few details: |
85 | | -# |
86 | | -# * Cartopy is the default backend. When you request projections with |
87 | | -# cartopy as the backend, the returned axes is a subclass of cartopy's |
88 | | -# `cartopy.mpl.geoaxes.GeoAxes`. Under the hood, invoking |
89 | | -# `~proplot.axes.GeoAxes.format` with cartopy as the backend changes map bounds using |
90 | | -# `~cartopy.mpl.geoaxes.GeoAxes.set_extent`, adds major and minor gridlines using |
91 | | -# `~cartopy.mpl.geoaxes.GeoAxes.gridlines`, and adds geographic features using |
92 | | -# `~cartopy.mpl.geoaxes.GeoAxes.add_feature`. If you prefer, you can use the |
93 | | -# standard `cartopy.mpl.geoaxes.GeoAxes` methods just like you would in cartopy. |
94 | | -# If you need to use the underlying `~cartopy.crs.Projection` instance, it is |
95 | | -# available via the `~proplot.axes.GeoAxes.projection` attribute. |
| 82 | +# The `proplot.axes.GeoAxes` class uses either `cartopy`_ or `basemap`_ as "backends" |
| 83 | +# to :ref:`format the axes <ug_geoformat>` and :ref:`plot stuff <ug_geoplot>` in |
| 84 | +# the axes. A few details: |
| 85 | +# |
| 86 | +# * Cartopy is the default backend. When you request projection names with cartopy |
| 87 | +# as the backend (or pass a `cartopy.crs.Projection` to the `proj` keyword), the |
| 88 | +# returned axes is a subclass of `cartopy.mpl.geoaxes.GeoAxes`. Under the hood, |
| 89 | +# invoking `~proplot.axes.GeoAxes.format` with cartopy as the backend changes map |
| 90 | +# bounds using `~cartopy.mpl.geoaxes.GeoAxes.set_extent`, adds major and minor |
| 91 | +# gridlines using `~cartopy.mpl.geoaxes.GeoAxes.gridlines`, and adds geographic |
| 92 | +# features using `~cartopy.mpl.geoaxes.GeoAxes.add_feature`. If you prefer, you can |
| 93 | +# use the standard `cartopy.mpl.geoaxes.GeoAxes` methods just like you would in |
| 94 | +# cartopy. If you need to use the underlying `~cartopy.crs.Projection` instance, it |
| 95 | +# is available via the `~proplot.axes.GeoAxes.projection` attribute. |
96 | 96 | # |
97 | 97 | # * Basemap is an alternative backend. To use basemap, set :rcraw:`basemap` to |
98 | | -# ``True`` or pass ``basemap=True`` to the axes-creation command. When you request |
99 | | -# projections with basemap as the backend, the resulting axes class redirects |
100 | | -# the plotting methods plot, scatter, contour, contourf, pcolor, pcolormesh, |
101 | | -# quiver, streamplot, and barb to the identically named methods on the |
102 | | -# `~mpl_toolkits.basemap.Basemap` instance. This means you can work |
| 98 | +# ``True`` or pass ``basemap=True`` to the axes-creation command. When you |
| 99 | +# request a projection name with basemap as the backend (or pass a |
| 100 | +# `~mpl_toolkits.basemap.Basemap` to the `proj` keyword), the returned axes |
| 101 | +# redirects the plotting methods plot, scatter, contour, contourf, pcolor, |
| 102 | +# pcolormesh, quiver, streamplot, and barb to the identically named methods on |
| 103 | +# the `~mpl_toolkits.basemap.Basemap` instance. This means you can work |
103 | 104 | # with the standard axes plotting methods rather than the basemap methods -- |
104 | 105 | # just like cartopy. Under the hood, invoking `~proplot.axes.GeoAxes.format` |
105 | 106 | # with basemap as the backend adds major and minor gridlines using |
|
111 | 112 | # available via the `~proplot.axes.GeoAxes.projection` attribute. |
112 | 113 | # |
113 | 114 | # Together, these features let you work with geophysical data without invoking |
114 | | -# verbose cartopy classes like `~cartopy.crs.LambertAzimuthalEqualArea` |
115 | | -# or keeping track of separate `~mpl_toolkits.basemap.Basemap` instances. They |
116 | | -# considerably reduce the amount of code needed to make geographic plots. |
117 | | -# In the below examples, we create a variety of geographic plots using both |
| 115 | +# verbose cartopy classes like `~cartopy.crs.LambertAzimuthalEqualArea` or |
| 116 | +# keeping track of separate `~mpl_toolkits.basemap.Basemap` instances. This |
| 117 | +# considerably reduces the amount of code needed to make complex geographic |
| 118 | +# plots. In the below examples, we create a variety of plots using both |
118 | 119 | # cartopy and basemap as backends. |
119 | 120 | # |
120 | 121 | # .. note:: |
|
124 | 125 | # <https://scitools.org.uk/cartopy/docs/latest/gallery/lines_and_polygons/always_circular_stereo.html>`__ |
125 | 126 | # from the cartopy website). This is consistent with basemap's default behavior. |
126 | 127 | # To disable this feature, set :rcraw:`cartopy.circular` to ``False``. |
127 | | -# Please note that cartopy cannot add gridline labels to polar plots with |
128 | | -# circular boundaries. |
| 128 | +# Please note that cartopy cannot add gridline labels to polar plots |
| 129 | +# with circular boundaries. |
129 | 130 | # * By default, ProPlot uses `~cartopy.mpl.geoaxes.GeoAxes.set_global` to give |
130 | 131 | # non-polar cartopy projections global extent and bounds polar cartopy projections |
131 | 132 | # at the equator. This is a deviation from cartopy, which determines map boundaries |
|
434 | 435 | # To create `polar axes <polar_>`_, pass ``proj='polar'`` to an axes-creation |
435 | 436 | # command (see :ref:`above <ug_proj>`). This returns `proplot.axes.PolarAxes` |
436 | 437 | # instance(s) with their own `~proplot.axes.PolarAxes.format` command. |
437 | | -# |
438 | | -# The `proplot.axes.PolarAxes.format` command facilitates polar-specific axes |
439 | | -# modifications like changing the central radius `r0`, the zero azimuth location |
440 | | -# `theta0`, and the positive azimuthal direction `thetadir`. It also supports |
441 | | -# changing gridline locations with `rlocator` and `thetalocator` (analogous to |
| 438 | +# `proplot.axes.PolarAxes.format` facilitates polar-specific axes modifications |
| 439 | +# like changing the central radius `r0`, the zero azimuth location `theta0`, |
| 440 | +# and the positive azimuthal direction `thetadir`. It also supports changing |
| 441 | +# gridline locations with `rlocator` and `thetalocator` (analogous to |
442 | 442 | # `ylocator` and `xlocator` used by `proplot.axes.CartesianAxes.format`) and |
443 | | -# turning your polar plot into an "annular" or "sector" plot by changing the radial |
444 | | -# limits `rlim` or the azimuthal limits `thetalim`. Finally, since |
445 | | -# `proplot.axes.PolarAxes.format` calls `proplot.axes.Axes.format`, it can be |
446 | | -# used to add axes titles, a-b-c labels, and figure titles, just like |
447 | | -# `~proplot.axes.CartesianAxes`. |
| 443 | +# creating "annular" or "sector" plots by changing the radial or azimuthal |
| 444 | +# limits `rlim` and `thetalim`. Finally, since `proplot.axes.PolarAxes.format` |
| 445 | +# calls `proplot.axes.Axes.format`, it can be used to add axes titles, a-b-c |
| 446 | +# labels, and figure titles, just like `~proplot.axes.CartesianAxes`. |
448 | 447 | # |
449 | 448 | # For details, see `proplot.axes.PolarAxes.format`. |
450 | 449 |
|
|
0 commit comments