Skip to content

Commit

Permalink
Cleanup and use cartopy 0.20 for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukelbd committed Jan 23, 2022
1 parent 6dc9201 commit a0011c3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ notifications:
email: false

python:
- "3.6"
- "3.7"

before_install:
- |
Expand Down
7 changes: 3 additions & 4 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ name: proplot-dev
channels:
- conda-forge
dependencies:
- python>=3.6
- python==3.7
- numpy
- pandas
- xarray
- matplotlib==3.2.1
- cartopy==0.19.0.post1
- shapely==1.7.1
- matplotlib==3.2.2
- cartopy==0.20.2
- ipykernel
- pandoc
- python-build
Expand Down
19 changes: 9 additions & 10 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ the docs during a python session.

Please note that proplot removes the associated documentation when functionality
is deprecated (see :ref:`What's New <whats_new>`). However, proplot adheres to
`semantic versioning <https://semver.org>`__, which means old code that uses deprecated
functionality will 1) still work and 2) issue warnings rather than errors until the
first major release (i.e. version 1.0.0).
`semantic versioning <https://semver.org>`__, which means old code that uses
deprecated functionality will still work and issue warnings rather than errors
until the first major release (version 1.0.0).

.. important::

The color transformation functions like `to_rgba` and `scale_luminance` from
proplot < 0.10.0 can now be found as methods on the new `~proplot.colors.Color`
class. Please see `~proplot.colors.Color` for the relevant documentation. Note that
old code that uses commands like ``pplt.to_rgba()`` and ``pplt.scale_luminance()``
will still work -- but it will result in a deprecation warning.
class. Note that old code that uses commands like ``pplt.to_rgba()`` and
``pplt.scale_luminance()`` will still work (but result in a deprecation warning).

.. important::

The documentation for "wrapper" functions like `standardize_1d` and `cmap_changer`
from proplot < 0.8.0 like can now be found under individual `~proplot.axes.PlotAxes`
methods like `~proplot.axes.PlotAxes.pcolor`. Please see `~proplot.axes.PlotAxes` for
the relevant documentation. Note that calling ``help(ax.method)`` in a python session
will show both the proplot documentation and the original matplotlib documentation.
from proplot < 0.8.0 can now be found under individual `~proplot.axes.PlotAxes`
methods like `~proplot.axes.PlotAxes.plot` and `~proplot.axes.PlotAxes.pcolor`. Note
that calling ``help(ax.method)`` in a python session will show both the proplot
documentation and the original matplotlib documentation.

Figure class
============
Expand Down
9 changes: 3 additions & 6 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# use 3.2.1. Probably lots of basemap holdouts for next ~5 years.
# * basemap geography is weird with the geos >= 3.9.0 required by cartopy >=
# 0.19, but important to use 0.19 becuase it fixes padding, so live with it.
# * cartopy 0.20 makes grid labels look nicer, but it requires python 3.9.
# will wait a couple years to catch up to them and keep python 3.6 for now.
# * pyqt5 is needed by pyplot, RTD server *happens* to already have it
# but creating local environment will fail.
# * jinja >= 3.0 and nbsphinx >= 0.8.2 seem to break default ReST roles when
Expand All @@ -16,13 +14,12 @@ name: proplot-dev
channels:
- conda-forge
dependencies:
- python>=3.6
- python==3.8
- numpy
- pandas
- xarray
- matplotlib==3.2.1
- cartopy==0.19.0.post1
- shapely==1.7.1
- matplotlib==3.2.2
- cartopy==0.20.2
- ipykernel
- pandoc
- pip
Expand Down
37 changes: 20 additions & 17 deletions docs/why.rst
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,18 @@ concise figures.
commands can easily draw colorbars and legends intended to reference more than
one subplot in arbitrary contiguous rows and columns. See the
:ref:`next section <why_colorbars_legends>` for details.
* The `~proplot.axes.Axes.panel_axes` (shorthand `~proplot.axes.Axes.panel`) commands
can draw :ref:`thin panels <ug_panels>` along the edges of subplots. This
can be useful for plotting 1D summary statistics alongside 2D plots.
* A-b-c labels can be added to subplots simply using the :rcraw:`abc`
setting -- for example, ``pplt.rc['abc'] = 'A.'`` or ``axs.format(abc='A.')``.
This is possible because `~proplot.figure.Figure.add_subplot` assigns a unique
`~proplot.axes.Axes.number` to every new subplot.
* The `proplot.gridspec.SubplotGrid.format` command can easily format multiple subplots
at once or add colorbars, legends, panels, twin axes, or inset axes to multiple
subplots at once. A `~proplot.gridspec.SubplotGrid` is returned by
`proplot.figure.Figure.subplots`, and can be indexed like a list or like a 2D
array (in which case the indices match the subplot grid extents).
`proplot.figure.Figure.subplots`, and can be indexed like a list or a 2D array.
* The `~proplot.axes.Axes.panel_axes` (shorthand `~proplot.axes.Axes.panel`) commands
draw :ref:`thin panels <ug_panels>` along the edges of subplots. This can be useful
for plotting 1D summary statistics alongside 2D plots. You can also add twin axes and
panel axes to several subplots at once using `~proplot.gridspec.SubplotGrid` commands.

Links
-----
Expand Down Expand Up @@ -798,19 +798,22 @@ This may be confusing for users outside of the United States.
Solution
--------

Proplot introduces the physical units engine `~proplot.utils.units` for
interpreting `figsize`, `figwidth`, `figheight`, `refwidth`, `refheight`,
`left`, `right`, `top`, `bottom`, `wspace`, `hspace`, and keyword arguments in a
few other places. Acceptable units include inches, centimeters, millimeters,
Proplot uses physical units for the `~proplot.gridspec.GridSpec` keywords
`left`, `right`, `top`, `bottom`, `wspace`, `hspace`, `pad`, `outerpad`, and
`innerpad`. The default unit (assumed when a numeric argument is passed) is
`em-widths <https://en.wikipedia.org/wiki/Em_(typography)>`__. Em-widths are
particularly appropriate for this context, as plot text can be a useful "ruler"
when figuring out the amount of space you need. Proplot also permits arbitrary
string units for these keywords, for the `~proplot.figure.Figure` keywords
`figsize`, `figwidth`, `figheight`, `refwidth`, and `refheight`, and in a
few other places. This is powered by the physical units engine `~proplot.utils.units`.
Acceptable units include inches, centimeters, millimeters,
pixels, `points <https://en.wikipedia.org/wiki/Point_(typography)>`__, `picas
<https://en.wikipedia.org/wiki/Pica_(typography)>`__, and `em-heights
<https://en.wikipedia.org/wiki/Em_(typography)>`__ (a table of acceptable units
is found :ref:`here <units_table>`). Em-heights are particularly useful, as the
figure text can be a useful "ruler" when figuring out the amount of space you
need. The `~proplot.utils.units` function also translates rc settings assigned
to `~proplot.config.rc_matplotlib` and `~proplot.config.rc_proplot`, e.g.
:rcraw:`axes.labelpad`, :rcraw:`legend.handlelength`, and
:rcraw:`subplot.refwidth`.
<https://en.wikipedia.org/wiki/Pica_(typography)>`__, and (a table of acceptable
units is found :ref:`here <units_table>`). Note the `~proplot.utils.units` engine
also translates rc settings assigned to `~proplot.config.rc_matplotlib` and
`~proplot.config.rc_proplot`, e.g. :rcraw:`subplots.refwidth`,
# :rcraw:`legend.columnspacing`, and :rcraw:`axes.labelpad`.

Links
-----
Expand Down
2 changes: 1 addition & 1 deletion proplot/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ def Proj(
raise RuntimeError(
'Basemap is no longer maintained and is incompatible with '
'matplotlib >= 3.3. Please use cartopy as your geographic '
'plotting backend or downgrade to matplotlib <= 3.2.'
'plotting backend or downgrade to matplotlib < 3.3.'
)
reso = _not_none(
reso=kwargs.pop('reso', None),
Expand Down

0 comments on commit a0011c3

Please sign in to comment.