Skip to content

Commit 1a0af55

Browse files
authored
Merge pull request #101 from lukelbd/proplotrc-changes
.proplotrc changes and related improvements
2 parents 6fdf978 + 2b2717b commit 1a0af55

File tree

10 files changed

+304
-266
lines changed

10 files changed

+304
-266
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
.vimsession
44
.*.sw[a-z]
55

6+
# Ignore auto-generated files
7+
proplotrc
8+
69
# PyPi stuff
710
build
811
dist

CHANGELOG.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,42 @@ ProPlot v0.5.0 (2020-##-##)
3838
stacks rather than getting inserted directly into
3939
the main `~proplot.subplots.GridSpec` (:pr:`50`).
4040

41+
ProPlot v0.4.1 (2020-01-08)
42+
===========================
43+
.. rubric:: Deprecation
44+
45+
- Change the default ``.proplotrc`` format from YAML to the ``.matplotlibrc``
46+
syntax (:pr:`101`).
47+
48+
.. rubric:: Features
49+
50+
- Comments (lines starting with ``#``) are now permitted in all RGB and HEX style
51+
colormap and cycle files (:pr:`100`).
52+
- Break down `~proplot.styletools.show_cycles` bars into categories, just
53+
like `~proplot.styletools.show_cmaps` (:pr:`100`).
54+
55+
.. rubric:: Bug fixes
56+
57+
- Fix issue where `~proplot.styletools.show_cmaps` and `~proplot.styletools.show_cycles`
58+
draw empty axes (:pr:`100`).
59+
- Add back the :ref:`default .proplorc file <The .proplotrc file>` to docs (:pr:`101`).
60+
To do this, ``conf.py`` auto-generates a file in ``_static``.
61+
62+
.. rubric:: Internals
63+
64+
- Add ``geogrid.color/linewidth/etc`` and ``gridminor.color/linewidth/etc`` props
65+
as *children* of ``grid.color/linewidth/etc`` (:pr:`101`).
66+
- Various `~proplot.rctools.rc_configurator` improvements, remove outdated
67+
global variables (:pr:`101`).
68+
- Better error handling when loading colormap/cycle files, and calls to
69+
`~proplot.styletools.Colormap` and `~proplot.styletools.Cycle` now raise errors while
70+
calls to `~proplot.styletools.register_cmaps` and `~proplot.styletools.register_cycles`
71+
still issue warnings (:pr:`100`).
72+
4173
ProPlot v0.4.0 (2020-01-07)
4274
===========================
4375
.. rubric:: Deprecated
4476

45-
4677
- Rename `basemap_defaults` to `~proplot.projs.basemap_kwargs` and `cartopy_projs`
4778
to `~proplot.projs.cartopy_names` (:commit:`431a06ce`).
4879
- Remove ``subplots.innerspace``, ``subplots.titlespace``,

docs/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
import os
1515
import sys
16+
from proplot.rctools import _write_defaults
1617
from pygments.formatters import HtmlFormatter
1718
from pygments.styles import get_all_styles
1819

19-
# Sphinx-automodapi requires proplot on path
20+
# Add proplot to path for sphinx-automodapi
2021
sys.path.insert(0, os.path.abspath('..'))
2122

2223
# Add docs folder to PATH for local 'sphinxext' extensions
@@ -194,6 +195,9 @@
194195
with open(path, 'w') as f:
195196
f.write(HtmlFormatter(style=style).get_style_defs('.highlight'))
196197

198+
# Create sample .proplotrc file
199+
_write_defaults(os.path.join('_static', 'proplotrc'), comment=False)
200+
197201
# Role
198202
# default family is py, but can also set default role so don't need
199203
# :func:`name`, :module:`name`, etc.

docs/configuration.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ Overview
77
A special object named `~proplot.rctools.rc`, belonging to the
88
`~proplot.rctools.rc_configurator` class, is created on import.
99
This is your one-stop shop for changing global settings belonging to any of
10-
the following three categories.
10+
the following three categories:
1111

1212
1. Builtin matplotlib `rcParams <https://matplotlib.org/users/customizing.html>`__
1313
settings. These have the format ``x.y`` or ``x.y.z``.
1414
2. ProPlot :ref:`rcParamsLong` settings. These also have the format ``x.y``
1515
(see below).
1616
3. ProPlot :ref:`rcParamsShort` settings. These have no dots (see below).
1717

18-
You can change settings with the `~proplot.rctools.rc` object as follows.
18+
You can change settings with the `~proplot.rctools.rc` object as follows:
1919

2020
* ``plot.rc.name = value``
2121
* ``plot.rc['name'] = value``
2222
* ``plot.rc.update(name1=value1, name2=value2)``
2323
* ``plot.rc.update({'name1':value1, 'name2':value2})``
2424

2525
To temporarily change settings on a particular axes, use either of the
26-
following.
26+
following:
2727

2828
* ``ax.format(name=value)``
2929
* ``ax.format(rc_kw={'name':value})``
@@ -102,8 +102,8 @@ There are two new additions to the ``image`` category, and the new
102102
`~proplot.axes.Axes.colorbar` properties.
103103
The new ``gridminor`` category controls minor gridline settings,
104104
and the new ``geogrid`` category controls meridian and parallel line settings
105-
for `~proplot.axes.ProjAxes`. For both ``gridminor`` and ``geogrid``, if
106-
a property is empty, the corresponding property from ``grid`` is used.
105+
for `~proplot.axes.ProjAxes`. Note that when a ``grid`` property is changed,
106+
it also changed the corresponding ``gridminor`` property.
107107

108108
Finally, the ``geoaxes``, ``land``, ``ocean``, ``rivers``, ``lakes``,
109109
``borders``, and ``innerborders`` categories control various
@@ -195,11 +195,9 @@ To modify the global settings, edit your
195195
``~/.proplotrc`` file. To modify settings for a particular project,
196196
create a ``.proplotrc`` file in the same directory as your ipython
197197
notebook, or in an arbitrary parent directory.
198+
As an example, a ``.proplotrc`` file containing the default settings
199+
is shown below. The syntax is mostly the same as the syntax used for
200+
`matplotlibrc files <https://matplotlib.org/3.1.1/tutorials/introductory/customizing.html#customizing-with-matplotlibrc-files>`__.
198201

199-
As an example, the default ``.proplotrc`` file
200-
is shown below. The syntax is roughly the same as that used for
201-
``matplotlibrc`` files, although ``.proplotrc`` strictly adheres to
202-
`YAML <https://en.wikipedia.org/wiki/YAML>`__.
203-
204-
.. include:: ../proplot/.proplotrc
202+
.. include:: _static/proplotrc
205203
:literal:

docs/environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies:
1818
- pip
1919
- pip:
2020
- ..
21-
- pyyaml
2221
- pyqt5
2322
- nbsphinx
2423
- sphinx_rtd_theme

proplot/axes.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import matplotlib.collections as mcollections
1818
from . import projs, axistools
1919
from .utils import _warn_proplot, _notNone, units, arange, edges
20-
from .rctools import rc, RC_NODOTSNAMES
20+
from .rctools import rc, _rc_nodots
2121
from .wrappers import (
2222
_get_transform, _norecurse, _redirect,
2323
_add_errorbars, _bar_wrapper, _barh_wrapper, _boxplot_wrapper,
@@ -107,7 +107,7 @@ def _parse_format(mode=2, rc_kw=None, **kwargs):
107107
kw = {}
108108
rc_kw = rc_kw or {}
109109
for key, value in kwargs.items():
110-
key_fixed = RC_NODOTSNAMES.get(key, None)
110+
key_fixed = _rc_nodots.get(key, None)
111111
if key_fixed is None:
112112
kw[key] = value
113113
else:
@@ -1691,7 +1691,7 @@ def _parse_alt(x, kwargs):
16911691
f'Twin axis keyword arg {key!r} is deprecated. '
16921692
f'Use {key[1:]!r} instead.')
16931693
kw_out[key] = value
1694-
elif key in RC_NODOTSNAMES:
1694+
elif key in _rc_nodots:
16951695
kw_out[key] = value
16961696
else:
16971697
kw_bad[key] = value
@@ -2383,14 +2383,9 @@ def _grid_dict(grid):
23832383
if which == 'major':
23842384
kw_grid = rc.fill(_grid_dict('grid'), context=True)
23852385
else:
2386-
kw_major = kw_grid
23872386
kw_grid = rc.fill(
23882387
_grid_dict('gridminor'), context=True
23892388
)
2390-
kw_grid.update({
2391-
key: value for key, value in kw_major.items()
2392-
if key not in kw_grid
2393-
})
23942389
# Changed rc settings
23952390
if gridcolor is not None:
23962391
kw['grid_color'] = gridcolor

proplot/axistools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def Locator(locator, *args, **kwargs):
141141

142142

143143
def Formatter(formatter, *args, date=False, index=False, **kwargs):
144-
r"""
144+
"""
145145
Return a `~matplotlib.ticker.Formatter` instance. This function is used to
146146
interpret the `xformatter`, `xformatter_kw`, `yformatter`, and
147147
`yformatter_kw` arguments when passed to
@@ -1092,12 +1092,12 @@ def transform_non_affine(self, a):
10921092

10931093

10941094
class MercatorLatitudeScale(_ScaleBase, mscale.ScaleBase):
1095-
r"""
1095+
"""
10961096
Axis scale that transforms coordinates as with latitude in the `Mercator \
10971097
projection <http://en.wikipedia.org/wiki/Mercator_projection>`__.
10981098
Adapted from `this matplotlib example \
10991099
<https://matplotlib.org/examples/api/custom_scale_example.html>`__.
1100-
The scale function is as follows:
1100+
"""r""""The scale function is as follows:
11011101
11021102
.. math::
11031103

0 commit comments

Comments
 (0)