Skip to content

Refactor rc_configurator and geoaxes, add new gridline features #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 102 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
db9407a
Add geogrid.axisbelow
lukelbd May 14, 2020
fbf7fd1
Add loninline/latinline properties, default is False
lukelbd May 14, 2020
e270c27
Turn some 'quick' params into longer name params
lukelbd May 14, 2020
8dc7905
Fix bugs associated with name changes
lukelbd May 14, 2020
5bea030
Improve inset, panel docs
lukelbd May 15, 2020
fd04e43
Support changing basemap resolution, cleanup proj docs
lukelbd May 15, 2020
95dae9f
Add rst links to tables
lukelbd May 15, 2020
d581b78
Remove premature inset_axes stuff
lukelbd May 15, 2020
2d79d04
Avoid 'truth value is ambiguous' errors
lukelbd May 15, 2020
8786073
Fix subplots docs
lukelbd May 15, 2020
cd4d1be
Update installation instructions
lukelbd May 15, 2020
e6dd831
Add methods for saving/loading files, remove 'quick' settings
lukelbd May 16, 2020
c2fec65
Remove premature cmap categories
lukelbd May 16, 2020
34d92a9
Combine rc_added and rc_quick in config.py
lukelbd May 16, 2020
06b8b5e
Update docs for new rc settings format
lukelbd May 16, 2020
4c0b069
Add quick example in basics notebook
lukelbd May 16, 2020
1ae0b79
Remove cmap.sequential references
lukelbd May 16, 2020
8807c0d
Add link to journals table in subplost notebook
lukelbd May 16, 2020
28ca4c1
Minor change to polar examples
lukelbd May 16, 2020
31ec728
Support passing filenames to rc.context
lukelbd May 16, 2020
cff12c1
Fix bug parsing quoted strings in rc files
lukelbd May 16, 2020
e232c7d
Fix _get_param_dicts bug
lukelbd May 17, 2020
8d31fd7
Rename 'small' and 'large' settings
lukelbd May 17, 2020
850f62c
Add abc.format to deprecated table
lukelbd May 17, 2020
73d6e40
Misc rcsetup cleanup
lukelbd May 17, 2020
2b05b4a
Support 'alternative' message for removed settings
lukelbd May 17, 2020
757fa35
Add new font-scaling definitions
lukelbd May 17, 2020
0655020
Add error message that prints available font scalings
lukelbd May 17, 2020
dcdd5a5
Rename font.small/font.large to text.labelsize/text.titlesize
lukelbd May 17, 2020
5aa9ceb
Move invalid colormap error to ColormapDatabase
lukelbd May 17, 2020
b6c26f6
Fix example after rc deprecation
lukelbd May 17, 2020
b45eafd
Misc cleanup
lukelbd May 17, 2020
a145a93
Rename xhi, xxhi to x-hi, xx-hi
lukelbd May 17, 2020
c79edb7
Fix bug parsing quoted proplotrc strings
lukelbd May 17, 2020
47910b8
Rename context fname kwarg to 'file', match load_file cmd
lukelbd May 17, 2020
ed91793
Use snippets for format() kwarg descrips
lukelbd May 17, 2020
40358ce
Use black style for rc.fill calls
lukelbd May 17, 2020
c00e731
Add explanation for various savefig changes
lukelbd May 17, 2020
1a30135
Add patch_kw to PolarAxes, cleanup docs
lukelbd May 17, 2020
51e6d7f
Clean up formatter locale stuff
lukelbd May 18, 2020
7e7be3b
Add special minor locator for geographic gridlines
lukelbd May 18, 2020
3b9e739
Register cartopy locators/formatters in constructor funcs
lukelbd May 18, 2020
c4a4ffd
Use lat/lon instead of clat/clon for cartopy ticker names
lukelbd May 18, 2020
7c0f118
Rename cartopy.global to cartopy.autoextent, update docs
lukelbd May 19, 2020
0ed90ba
Update lon/lat locator classes
lukelbd May 19, 2020
c0ead4e
Add longitude and latitude axis classes
lukelbd May 19, 2020
8092881
Clean up locators, apply latmax in _LatAxis
lukelbd May 19, 2020
a5ee53a
Import polar stereo projs in crs.py
lukelbd May 19, 2020
6b16562
Add zorder settings, remove latmax setting, cleanup
lukelbd May 19, 2020
8a9cff6
Misc config.py cleanup
lukelbd May 19, 2020
5ba6890
Misc docstring cleanup
lukelbd May 19, 2020
b5b2842
Add auto-generated rctable.rst to gitignore
lukelbd May 19, 2020
6c40308
Update lon/lat axes
lukelbd May 19, 2020
da135f6
Overhaul GeoAxes.format, add _update funcs, better locator/formatter …
lukelbd May 19, 2020
9cfd291
Update figures/ui for new subplots rc setting names
lukelbd May 19, 2020
b2706af
Fix validators for new font size scalings
lukelbd May 19, 2020
6edd0d7
Revert back to 0.6 linewidth default
lukelbd May 19, 2020
5e15f16
Increase default axwidth to 20em
lukelbd May 19, 2020
a19cf96
Revert back to original default ticklen of 4.0
lukelbd May 19, 2020
9af3a8c
Add 'wraprange' feature, use for longitude formatters
lukelbd May 19, 2020
60c1c72
Clean up wraprange stuff, use proplot formatters by default
lukelbd May 19, 2020
dd01204
Misc bugfixes
lukelbd May 19, 2020
3075d3f
Add settings for gridline label props, support in cartopy
lukelbd May 19, 2020
043fe16
Use dms=True by default, use partial funcs for formatter presets
lukelbd May 19, 2020
d8cb237
Add 'dms' keyword arg to GeoAxes.format
lukelbd May 19, 2020
4e1c424
Remove _default_crs wrapper
lukelbd May 19, 2020
95df5d3
More bugfixes
lukelbd May 19, 2020
331a961
Fix more dms issues
lukelbd May 19, 2020
040bb16
Register dmslon/dmslat as locators (undocumented for now)
lukelbd May 19, 2020
f994e69
Fix bugs drawing basemap meridians/parallels
lukelbd May 19, 2020
f5d6c05
Publicl register lon/lat locators
lukelbd May 19, 2020
37a7330
Geographic feature zorder fixes
lukelbd May 19, 2020
4d3eecf
Fix SimpleLocator bugs, make lon/lat locators public
lukelbd May 19, 2020
19af862
Fix bug where map boundaries was not updating
lukelbd May 19, 2020
0b32f0f
Update projections examples
lukelbd May 19, 2020
7dfe2bb
Rename rotate_labels --> rotatelabels for consistency
lukelbd May 19, 2020
4c935fe
Map boundary bugfixes, lon locator bugfixes, cleanup
lukelbd May 19, 2020
58a90bb
More gridlines bugs, basemap lon_0 bug, update examples
lukelbd May 19, 2020
4e10ae1
Show of minor gridlines
lukelbd May 19, 2020
6a9bc25
Add _get_context_mode func, used in geo.py
lukelbd May 19, 2020
62fb8a1
Better default padding for cartopy labels
lukelbd May 19, 2020
cb03932
Repair lon/lat formatters for non plate-carree projections
lukelbd May 19, 2020
f9dea84
Better names for _set_state attrs
lukelbd May 19, 2020
a6e5752
Fix issues with basemap gridlines, background
lukelbd May 19, 2020
3745bed
Fix cartopy bug with polar projections
lukelbd May 19, 2020
7364963
Fix axisbelow bug
lukelbd May 19, 2020
250e083
Better plotting data example
lukelbd May 19, 2020
383e32e
Update example
lukelbd May 19, 2020
d0deaca
Update changelog
lukelbd May 19, 2020
67a09f0
Update configuration page
lukelbd May 19, 2020
86bf22f
Remove references to 'small'/'large' rc settings
lukelbd May 19, 2020
59e09fa
Fix get_synced_params bug
lukelbd May 19, 2020
9d32b0b
Remove reference to removed setting
lukelbd May 19, 2020
ca154f4
Remove ref to removed setting
lukelbd May 19, 2020
68afce8
Fix panel() alias bug
lukelbd May 19, 2020
426feea
Comment out rc_configurator.save() during test
lukelbd May 19, 2020
678b20e
Fix ticklabelpad rename, add deprecated args to _rc_nodots
lukelbd May 19, 2020
9699984
Safe deprecation system for removed/renamed rc settings
lukelbd May 19, 2020
b378507
Fix transverse mercator issue
lukelbd May 19, 2020
965d1e5
Fix defaut basemap lcc
lukelbd May 19, 2020
8d784c1
More robust gridline updating for basemap axes
lukelbd May 19, 2020
80ec3b9
Fix docs, fix issues with default basemap kwargs
lukelbd May 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# Ignore auto-generated files
proplotrc
rctable.rst

# PyPi stuff
build
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ ProPlot v0.6.0 (2020-##-##)

There are quite a lot of deprecations for this release.

- Remove the ``geoaxes`` and ``geogrid`` rc settings (:pr:`168`). Gridline
settings are now controlled with ``grid``.
- Remove the ``lonstep`` and ``latstep`` settings -- we now use
`~proplot.ticker.LongitudeLocator` and `~proplot.ticker.LatitudeLocator`
to select "nice" gridline locations even when zoomed in (:pr:`168`)
- Rename `add_errorbars` to `~proplot.axes.plot.indicate_error` and rename
various keyword args (:pr:`166`, :commit:`d8c50a8d`).
- Remove ``'rgbcycle'`` setting (:commit:`6653b7f0`).
Expand Down Expand Up @@ -118,6 +123,24 @@ There are quite a lot of deprecations for this release.

.. rubric:: Features

- Use `_LonAxis` and `_LatAxis` dummy axes with custom `LongitudeLocator`
and `LatitudeLocator` to control geographic gridlines (:pr:`168`).
- Add ``'dmslat'`` and ``'dmslon'`` as formatters for cartopy projections,
along with ``dms`` `format` keyword argument. This labels points with
degrees/minutes/seconds when appropriate (:pr:`168`).
- Support "minor" geographic gridlines with the ``gridminor`` keyword
arg and existing ``gridminor`` settings (:pr:`168`). Default locator
used for minor gridlines is `~matplotlib.ticker.AutoMinorLocator`.
- Add `loninline`, `latinline`, and `rotatelabels` keywords for controlling
cartopy gridliner behavior (:pr:`168`).
- Add `proplot.config.rc_configurator.save` and
`proplot.config.rc_configurator.from_file` methods (:commit:`e6dd8314`).
- Increase default :rcraw:`savefig.dpi` to 1200, matching recommendations
from academic journals (:commit:`c00e7314`). Also add detailed discussion
to user guide.
- No longer distinguish between "quick" settings and proplot's "added"
settings (:commit:`e6dd8314`). Quick settings, added settings, and matplotlib
settings can all have "children" so the distinction no longer makes sense.
- Add options to `~proplot.axes.plot.indicate_error` for adding *shading*
to arbitrary plots (:pr:`166`, :commit:`d8c50a8d`). Also support automatic legend
entries for shading and ensure `indicate_error` preserves metadata.
Expand Down Expand Up @@ -181,6 +204,8 @@ There are quite a lot of deprecations for this release.

- Fix various issues with axis label sharing and axis sharing for
twinned axes and panel axes (:pr:`164`).
- Permit modifying existing cartopy geographic features with successive
calls to `~proplot.axes.GeoAxes.format` (:commit:`###`).
- Fix issue drawing bar plots with datetime *x* axes (:pr:`156`).
- Fix issue where `~proplot.ticker.AutoFormatter` tools were not locale-aware, i.e. use
comma as decimal point sometimes (:commit:`c7636296`).
Expand Down
3 changes: 1 addition & 2 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Likewise, an existing installation of ProPlot can be upgraded to the latest vers
conda upgrade proplot


If you used ``pip install git+https://github.com/lukelbd/proplot.git`` to install ProPlot before it was released on PyPi, you may need to run ``pip uninstall proplot`` before upgrading.
To install a development version of ProPlot, you can use this same method, or clone the repository and run ``pip install --upgrade .`` inside the ``proplot`` folder.
To install a development version of ProPlot, you can use ``pip install git+https://github.com/lukelbd/proplot.git`` or clone the repository and run ``pip install -e .`` inside the ``proplot`` folder.

ProPlot's only hard dependency is `matplotlib <https://matplotlib.org/>`__. The *soft* dependencies are `cartopy <https://scitools.org.uk/cartopy/docs/latest/>`__, `basemap <https://matplotlib.org/basemap/index.html>`__, `xarray <http://xarray.pydata.org>`__, and `pandas <https://pandas.pydata.org>`__. See the documentation for details.
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Likewise, an existing installation of ProPlot can be upgraded to the latest vers
pip install --upgrade proplot
conda upgrade proplot

If you used ``pip install git+https://github.com/lukelbd/proplot.git`` to install ProPlot before it was released on PyPi, you may need to run ``pip uninstall proplot`` before upgrading.
To install a development version of ProPlot, you can use this same method, or clone the repository and run ``pip install --upgrade .`` inside the ``proplot`` folder.
To install a development version of ProPlot, you can use ``pip install git+https://github.com/lukelbd/proplot.git`` or clone the repository and run ``pip install -e .`` inside the ``proplot`` folder.

Documentation
=============
Expand Down
9 changes: 4 additions & 5 deletions docs/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
state = np.random.RandomState(51423)
plot.rc.facecolor = plot.scale_luminance('powder blue', 1.15)
plot.rc.update(
linewidth=1,
small=10, large=12,
linewidth=1, fontsize=10,
color='dark blue', suptitlecolor='dark blue',
titleloc='upper center', titlecolor='dark blue', titleborder=False,
)
Expand Down Expand Up @@ -134,7 +133,7 @@
import proplot as plot
import numpy as np
plot.rc.update(
linewidth=1.2, small=10, large=12, facecolor='gray8', figurefacecolor='gray8',
linewidth=1.2, fontsize=10, facecolor='gray8', figurefacecolor='gray8',
suptitlecolor='w', gridcolor='w', color='w',
titleloc='upper center', titlecolor='w', titleborder=False,
)
Expand Down Expand Up @@ -177,7 +176,7 @@
# %%
import proplot as plot
plot.rc.linewidth = 2
plot.rc.small = plot.rc.large = 11
plot.rc.fontsize = 11
locator = [0, 0.25, 0.5, 0.75, 1]
fig, axs = plot.subplots([[1, 1, 2, 2], [0, 3, 3, 0]], axwidth=1.5, share=0)

Expand Down Expand Up @@ -221,7 +220,7 @@
import proplot as plot
import numpy as np
plot.rc.update(
linewidth=1.2, small=10, large=12, ticklenratio=0.7,
linewidth=1.2, fontsize=10, ticklenratio=0.7,
figurefacecolor='w', facecolor='pastel blue',
titleloc='upper center', titleborder=False,
)
Expand Down
27 changes: 18 additions & 9 deletions docs/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# %% [raw] raw_mimetype="text/restructuredtext"
# .. _ug_intro:
#
# Figures and subplots
# --------------------
# Creating figures
# ----------------
#
# ProPlot works by subclassing the matplotlib `~matplotlib.figure.Figure` and
# `~matplotlib.axes.Axes` classes. You can generate grids of proplot
Expand All @@ -47,12 +47,21 @@
# and modify the axes using `~proplot.axes.Axes.format` and
# `~proplot.ui.SubplotsContainer`. See the :ref:`formatting guide <ug_format>`
# and :ref:`subplots container <ug_container>` sections for details.
#
# Please note that by default, ProPlot sets :rcraw:`figure.facecolor` to gray,
# :rcraw:`savefig.facecolor` to white, and :rcraw:`savefig.transparent` to ``True``.
# That is, the default display background is gray, the default background for
# saved figures is transparent, and the default background is white when you pass
# ``transparent=False`` to `~matplotlib.figure.Figure.savefig`. See the
# :ref:`configuration section <ug_proplotrc>` for how to change this.
# ``transparent=False`` to `~matplotlib.figure.Figure.savefig`.
# ProPlot also sets the default :rcraw:`savefig.format` to PDF, because
# (1) vector graphic formats are always more suitable for matplotlib figures than
# raster formats, (2) most academic journals these days accept PDF format figures
# alongside the older EPS format, (3) PDF figures are easy to embed in LaTeX documents,
# and (4) the EPS format does not support transparent graphic elements. If you *do*
# need raster graphics, ProPlot sets the default :rcraw:`savefig.dpi` to 1200 dots per
# inch, which is recommended by most journals as the minimum resolution for rasterized
# figures containing lines and text. See the :ref:`configuration section <ug_proplotrc>`
# for how to change these settings.

# %%
import proplot as plot
Expand Down Expand Up @@ -218,11 +227,10 @@
# ProPlot. `~proplot.config.rc` is similar to the matplotlib
# `~matplotlib.rcParams` dictionary, but can be used to change (1)
# matplotlib's `builtin settings
# <https://matplotlib.org/tutorials/introductory/customizing.html>`_, (2)
# ProPlot's :ref:`added settings <rc_added>`, and (3) :ref:`quick settings
# <rc_quick>` that can be used to change lots of matplotlib and ProPlot
# settings at once. `~proplot.config.rc` also provides a ``style`` parameter
# that can be used to switch between `matplotlib stylesheets\
# <https://matplotlib.org/tutorials/introductory/customizing.html>`_ and
# (2) ProPlot's :ref:`added settings <rc_proplot>`. `~proplot.config.rc` also
# provides a ``style`` parameter that can be used to switch between
# `matplotlib stylesheets\
# <https://matplotlib.org/3.1.1/gallery/style_sheets/style_sheets_reference.html>`__.
# See the :ref:`configuration section <ug_config>` for details.
#
Expand All @@ -245,6 +253,7 @@
plot.rc.update({'fontname': 'Noto Sans'})
plot.rc['figure.facecolor'] = 'gray3'
plot.rc.axesfacecolor = 'gray4'
# plot.rc.save() # save the current settings to ~/.proplotrc

# Apply settings to figure with context()
with plot.rc.context({'suptitle.size': 11}, toplabelcolor='gray6', linewidth=1.5):
Expand Down
2 changes: 1 addition & 1 deletion docs/colormaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

# Monochromatic colormaps
axs.format(
xlabel='x axis', ylabel='y axis', span=False,
xlabel='x axis', ylabel='y axis',
suptitle='Building your own PerceptuallyUniformColormaps'
)
data = state.rand(30, 30).cumsum(axis=1)
Expand Down
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@
f.write(HtmlFormatter(style=style).get_style_defs('.highlight'))

# Create sample .proplotrc file
from proplot.config import _write_defaults # noqa: E402
_write_defaults(os.path.join('_static', 'proplotrc'), comment=False)
from proplot.config import rc
rc._save_proplotrc(os.path.join('_static', 'proplotrc'))
rc._save_rst(os.path.join('_static', 'rctable.rst'))

# Role
# default family is py, but can also set default role so don't need
Expand Down
Loading