Skip to content

Commit dc76d19

Browse files
authored
Merge pull request #167 from lukelbd/geogrid-features
Refactor rc_configurator and geoaxes, add new gridline features
2 parents 6903e33 + 80ec3b9 commit dc76d19

26 files changed

+3232
-1896
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# Ignore auto-generated files
77
proplotrc
8+
rctable.rst
89

910
# PyPi stuff
1011
build

CHANGELOG.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ ProPlot v0.6.0 (2020-##-##)
7171

7272
There are quite a lot of deprecations for this release.
7373

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

119124
.. rubric:: Features
120125

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

182205
- Fix various issues with axis label sharing and axis sharing for
183206
twinned axes and panel axes (:pr:`164`).
207+
- Permit modifying existing cartopy geographic features with successive
208+
calls to `~proplot.axes.GeoAxes.format` (:commit:`###`).
184209
- Fix issue drawing bar plots with datetime *x* axes (:pr:`156`).
185210
- Fix issue where `~proplot.ticker.AutoFormatter` tools were not locale-aware, i.e. use
186211
comma as decimal point sometimes (:commit:`c7636296`).

INSTALL.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Likewise, an existing installation of ProPlot can be upgraded to the latest vers
1616
conda upgrade proplot
1717
1818
19-
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.
20-
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.
19+
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.
2120

2221
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.

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Likewise, an existing installation of ProPlot can be upgraded to the latest vers
2222
pip install --upgrade proplot
2323
conda upgrade proplot
2424
25-
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.
26-
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.
25+
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.
2726

2827
Documentation
2928
=============

docs/axis.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@
5858
state = np.random.RandomState(51423)
5959
plot.rc.facecolor = plot.scale_luminance('powder blue', 1.15)
6060
plot.rc.update(
61-
linewidth=1,
62-
small=10, large=12,
61+
linewidth=1, fontsize=10,
6362
color='dark blue', suptitlecolor='dark blue',
6463
titleloc='upper center', titlecolor='dark blue', titleborder=False,
6564
)
@@ -134,7 +133,7 @@
134133
import proplot as plot
135134
import numpy as np
136135
plot.rc.update(
137-
linewidth=1.2, small=10, large=12, facecolor='gray8', figurefacecolor='gray8',
136+
linewidth=1.2, fontsize=10, facecolor='gray8', figurefacecolor='gray8',
138137
suptitlecolor='w', gridcolor='w', color='w',
139138
titleloc='upper center', titlecolor='w', titleborder=False,
140139
)
@@ -177,7 +176,7 @@
177176
# %%
178177
import proplot as plot
179178
plot.rc.linewidth = 2
180-
plot.rc.small = plot.rc.large = 11
179+
plot.rc.fontsize = 11
181180
locator = [0, 0.25, 0.5, 0.75, 1]
182181
fig, axs = plot.subplots([[1, 1, 2, 2], [0, 3, 3, 0]], axwidth=1.5, share=0)
183182

@@ -221,7 +220,7 @@
221220
import proplot as plot
222221
import numpy as np
223222
plot.rc.update(
224-
linewidth=1.2, small=10, large=12, ticklenratio=0.7,
223+
linewidth=1.2, fontsize=10, ticklenratio=0.7,
225224
figurefacecolor='w', facecolor='pastel blue',
226225
titleloc='upper center', titleborder=False,
227226
)

docs/basics.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
# %% [raw] raw_mimetype="text/restructuredtext"
2323
# .. _ug_intro:
2424
#
25-
# Figures and subplots
26-
# --------------------
25+
# Creating figures
26+
# ----------------
2727
#
2828
# ProPlot works by subclassing the matplotlib `~matplotlib.figure.Figure` and
2929
# `~matplotlib.axes.Axes` classes. You can generate grids of proplot
@@ -47,12 +47,21 @@
4747
# and modify the axes using `~proplot.axes.Axes.format` and
4848
# `~proplot.ui.SubplotsContainer`. See the :ref:`formatting guide <ug_format>`
4949
# and :ref:`subplots container <ug_container>` sections for details.
50+
#
5051
# Please note that by default, ProPlot sets :rcraw:`figure.facecolor` to gray,
5152
# :rcraw:`savefig.facecolor` to white, and :rcraw:`savefig.transparent` to ``True``.
5253
# That is, the default display background is gray, the default background for
5354
# saved figures is transparent, and the default background is white when you pass
54-
# ``transparent=False`` to `~matplotlib.figure.Figure.savefig`. See the
55-
# :ref:`configuration section <ug_proplotrc>` for how to change this.
55+
# ``transparent=False`` to `~matplotlib.figure.Figure.savefig`.
56+
# ProPlot also sets the default :rcraw:`savefig.format` to PDF, because
57+
# (1) vector graphic formats are always more suitable for matplotlib figures than
58+
# raster formats, (2) most academic journals these days accept PDF format figures
59+
# alongside the older EPS format, (3) PDF figures are easy to embed in LaTeX documents,
60+
# and (4) the EPS format does not support transparent graphic elements. If you *do*
61+
# need raster graphics, ProPlot sets the default :rcraw:`savefig.dpi` to 1200 dots per
62+
# inch, which is recommended by most journals as the minimum resolution for rasterized
63+
# figures containing lines and text. See the :ref:`configuration section <ug_proplotrc>`
64+
# for how to change these settings.
5665

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

249258
# Apply settings to figure with context()
250259
with plot.rc.context({'suptitle.size': 11}, toplabelcolor='gray6', linewidth=1.5):

docs/colormaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178

179179
# Monochromatic colormaps
180180
axs.format(
181-
xlabel='x axis', ylabel='y axis', span=False,
181+
xlabel='x axis', ylabel='y axis',
182182
suptitle='Building your own PerceptuallyUniformColormaps'
183183
)
184184
data = state.rand(30, 30).cumsum(axis=1)

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@
216216
f.write(HtmlFormatter(style=style).get_style_defs('.highlight'))
217217

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

222223
# Role
223224
# default family is py, but can also set default role so don't need

0 commit comments

Comments
 (0)