Skip to content

Commit 3a62288

Browse files
committed
Fix notebook and resizable backend issues, rctools updates
1 parent 495289c commit 3a62288

File tree

11 files changed

+592
-381
lines changed

11 files changed

+592
-381
lines changed

CHANGELOG.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ ProPlot v1.0.0 (2020-##-##)
1515
This will be published when some major refactoring tasks are completed.
1616
See :pr:`45`, :pr:`46`, and :pr:`50`.
1717

18+
ProPlot v0.2.0 (2019-12-02)
19+
===========================
20+
Features
21+
--------
22+
- Support manual resizing for all backends, including ``osx`` and ``qt``.
23+
24+
Bug fixes
25+
---------
26+
- Disable automatic resizing for the ``nbAgg`` interactive inline backend. Found no
27+
suitable workaround.
28+
- Remove several `~matplotlib.rcParams` settings from the default ``.proplotrc``.
29+
``savefig.dpi`` and ``savefig.transparent`` were affecting the ``nbAgg``
30+
interactive inline backend.
31+
32+
Deprecated
33+
----------
34+
- Remove the ``nbsetup`` rc setting in favor of separate ``autosave``, ``autoreload``,
35+
and ``matplotlib`` settings for triggering the respective ``%`` magic commands.
36+
(``nbsetup`` is still accepted but no longer documented).
37+
- Rename the ``format`` rc setting in favor of the ``inlinefmt`` setting
38+
(``format`` is still accepted but no longer documented).
39+
- Rename ``FlexibleGridSpec`` and ``FlexibleSubplotSpec`` to ``GridSpec``
40+
and ``SubplotSpec`` (until :pr:`50` is merged it is impossible
41+
to use these manually, so this won't bother anyone).
42+
43+
Internals
44+
---------
45+
- Rename ``rcParamsCustom`` to ``rcParamsLong`` (this is inaccessible to the user).
46+
- When calling ``fig.canvas.print_figure()`` on a stale figure, call ``fig.canvas.draw()``
47+
first. May be overkill for `~matplotlib.figure.Figure.savefig` but critical for
48+
correctly displaying already-drawn notebook figures.
49+
1850
ProPlot v0.1.3 (2019-12-01)
1951
===========================
2052
Internals

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. image:: https://github.com/lukelbd/proplot/blob/master/docs/_static/logo_long.png?raw=true
22
:width: 1000px
33

4-
|build-status| |docs| |license| |gitter| |pr-welcome|
4+
|build-status| |docs| |pypi| |license| |gitter| |pr-welcome|
55

66
A comprehensive, easy-to-use `matplotlib <https://matplotlib.org/>`__ wrapper for making beautiful, publication-quality graphics.
77

@@ -33,6 +33,10 @@ The documentation is `published on readthedocs <https://proplot.readthedocs.io>`
3333
:alt: docs
3434
:target: https://proplot.readthedocs.io/en/latest/?badge=latest
3535

36+
.. |pypi| image:: https://badge.fury.io/py/proplot.svg
37+
:alt: pypi
38+
:target: https://badge.fury.io/py/proplot
39+
3640
.. |gitter| image:: https://badges.gitter.im/gitterHQ/gitter.svg
3741
:alt: gitter
3842
:target: https://gitter.im/pro-plot/community

docs/.proplotrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Tested SVG vs. PNG and speeds are comparable!
55
small: 9
66
large: 10
7-
format: svg
8-
nbsetup: True
7+
inlinefmt: svg
8+
matplotlib: 'auto'

docs/authors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Contributors
1111

1212
Bios
1313
----
14-
`Luke Davis`_ is the sole developer as of November 2019. He is a graduate student in climate science at Colorado State University who has always been frustrated by repetitive and clumsy plotting code. As an undergraduate, he developed an extensive set of `MATLAB plotting utilities <https://github.com/lukelbd/matfuncs>`__ for personal use. When he switched to python in graduate school, he replicated most of these utilities in python, learned more about the language, began to rapidly develop them, and thought they were worth sharing with the rest of the scientific community. He has sunk countless hours into this project and hopes you find it useful. If you are feeling generous, he is also `accepting donations <https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VMJSNABTFF4AA&source=url>`__ ;). Luke is also a vim enthusiast and has authored `a number of vim plugins <https://github.com/lukelbd?tab=repositories>`__.
14+
`Luke Davis`_ is the sole developer as of November 2019. He is a graduate student in climate science at Colorado State University who has always been frustrated by repetitive and clumsy plotting code. As an undergraduate, he developed an extensive set of `MATLAB plotting utilities <https://github.com/lukelbd/matfuncs>`__ for personal use. When he switched to python in graduate school, he replicated most of these utilities in python, learned more about the language, began to rapidly develop them, and thought they were worth sharing with the rest of the scientific community. He has sunk countless hours into this project and hopes you find it useful. Luke is also a vim enthusiast and has authored `a number of vim plugins <https://github.com/lukelbd?tab=repositories>`__.
1515

1616
`Riley Brady`_ is an important contributor. He helped the authors organize and deploy this project, set up automatic testing, and allow new contributors to join. He is also the earliest user of ProPlot and helped fix a lot of the initial bugs. If your field is atmospheric science, check out his `decadal climate prediction package <https://github.com/bradyrx/climpred>`__.
1717

docs/configuration.rst

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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``.
14-
2. ProPlot :ref:`rcParamsCustom` settings. These also have the format ``x.y``
14+
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

@@ -41,51 +41,56 @@ ProPlot settings at once, as shorthands for settings with longer names, or
4141
for special options. For example, :rcraw:`ticklen` changes the tick length for
4242
the *x* and *y* axes in one go.
4343

44-
================ ====================================================================================================================================================================================================================================
44+
================ ==============================================================================================================================================================================================================================================
4545
Key Description
46-
================ ====================================================================================================================================================================================================================================
47-
``nbsetup`` Whether to run `~proplot.rctools.nb_setup` on import. Can only be changed from the ``~/.proplotrc`` file.
48-
``format`` The inline backend figure format, one of ``retina``, ``png``, ``jpeg``, ``pdf``, or ``svg``. Can only be changed from the ``~/.proplotrc`` file.
49-
``autosave`` If not empty or ``0`` and :rcraw:`nbsetup` is ``True``, passed to `%autosave <https://www.webucator.com/blog/2016/03/change-default-autosave-interval-in-ipython-notebook/>`__. Can only be changed from the ``~/.proplotrc`` file.
50-
``autoreload`` If not empty or ``0`` and :rcraw:`nbsetup` is ``True``, passed to `%autoreload <https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html#magic-autoreload>`__. Can only be changed from the ``~/.proplotrc`` file.
51-
``abc`` Boolean, indicates whether to draw a-b-c labels by default.
52-
``tight`` Boolean, indicates whether to auto-adjust figure bounds and subplot spacings.
53-
``share`` The axis sharing level, one of ``0``, ``1``, ``2``, or ``3``. See `~proplot.subplots.subplots` for details.
46+
================ ==============================================================================================================================================================================================================================================
47+
``abc`` Boolean, whether to draw a-b-c labels by default.
5448
``align`` Whether to align axis labels during draw. See `aligning labels <https://matplotlib.org/3.1.1/gallery/subplots_axes_and_figures/align_labels_demo.html>`__.
55-
``span`` Boolean, toggles spanning axis labels. See `~proplot.subplots.subplots` for details.
56-
``fontname`` Name of font used for all text in the figure. The default is Helvetica Neue. See `~proplot.fonttools` for details.
49+
``alpha`` The opacity of the background axes patch.
50+
``autoreload`` If not empty or ``0``, passed to `%autoreload <https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html#magic-autoreload>`__.
51+
``autosave`` If not empty or ``0``, passed to `%autosave <https://www.webucator.com/blog/2016/03/change-default-autosave-interval-in-ipython-notebook/>`__.
52+
``borders`` Boolean, toggles country border lines on and off.
5753
``cmap`` The default colormap.
58-
``lut`` The number of colors to put in the colormap lookup table.
59-
``cycle`` The default color cycle name, used e.g. for lines.
60-
``rgbcycle`` If ``True``, and ``colorblind`` is the current cycle, this registers the ``colorblind`` colors as ``'r'``, ``'b'``, ``'g'``, etc., like in `seaborn <https://seaborn.pydata.org/tutorial/color_palettes.html>`__.
54+
``coast`` Boolean, toggles coastline lines on and off.
6155
``color`` The color of axis spines, tick marks, tick labels, and labels.
62-
``alpha`` The opacity of the background axes patch.
56+
``cycle`` The default color cycle name, used e.g. for lines.
6357
``facecolor`` The color of the background axes patch.
64-
``small`` Font size for legend text, tick labels, axis labels, and text generated with `~matplotlib.axes.Axes.text`.
65-
``large`` Font size for titles, "super" titles, and a-b-c subplot labels.
66-
``linewidth`` Thickness of axes spines and major tick lines.
67-
``margin`` The margin of space between axes edges and objects plotted inside the axes, if ``xlim`` and ``ylim`` are unset.
68-
``ticklen`` Length of major ticks in points.
69-
``tickdir`` Major and minor tick direction. Must be one of ``out``, ``in``, or ``inout``.
70-
``tickpad`` Padding between ticks and tick labels in points.
58+
``fontname`` Name of font used for all text in the figure. The default is Helvetica Neue. See `~proplot.fonttools` for details.
59+
``geogrid`` Boolean, toggles meridian and parallel gridlines on and off.
7160
``grid`` Boolean, toggles major grid lines on and off.
7261
``gridminor`` Boolean, toggles minor grid lines on and off.
73-
``tickratio`` Ratio of minor tickline width to major tickline width.
7462
``gridratio`` Ratio of minor gridline width to major gridline width.
75-
``ticklenratio`` Ratio of minor tickline length to major tickline length.
76-
``reso`` Resolution of geographic features, one of ``'lo'``, ``'med'``, or ``'hi'``
77-
``geogrid`` Boolean, toggles meridian and parallel gridlines on and off.
63+
``inlinefmt`` The inline backend figure format or list thereof. Valid formats include ``'svg'``, ``'pdf'``, ``'retina'``, ``'png'``, and ``jpeg``.
64+
``innerborders`` Boolean, toggles internal border lines on and off, e.g. for states and provinces.
65+
``lakes`` Boolean, toggles lake patches on and off.
7866
``land`` Boolean, toggles land patches on and off.
67+
``large`` Font size for titles, "super" titles, and a-b-c subplot labels.
68+
``linewidth`` Thickness of axes spines and major tick lines.
69+
``lut`` The number of colors to put in the colormap lookup table.
70+
``margin`` The margin of space between axes edges and objects plotted inside the axes, if ``xlim`` and ``ylim`` are unset.
71+
``matplotlib`` If not empty, passed to `%matplotlib <https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-matplotlib>`__. If ``'auto'`` (the default) uses ``'inline'`` for notebooks and ``'osx'`` or ``'qt'`` for other ipython sessions.
7972
``ocean`` Boolean, toggles ocean patches on and off.
80-
``lakes`` Boolean, toggles lake patches on and off.
81-
``coast`` Boolean, toggles coastline lines on and off.
82-
``borders`` Boolean, toggles country border lines on and off.
83-
``innerborders`` Boolean, toggles internal border lines on and off, e.g. for states and provinces.
73+
``reso`` Resolution of geographic features, one of ``'lo'``, ``'med'``, or ``'hi'``
74+
``rgbcycle`` If ``True``, and ``colorblind`` is the current cycle, this registers the ``colorblind`` colors as ``'r'``, ``'b'``, ``'g'``, etc., like in `seaborn <https://seaborn.pydata.org/tutorial/color_palettes.html>`__.
8475
``rivers`` Boolean, toggles river lines on and off.
85-
================ ====================================================================================================================================================================================================================================
76+
``share`` The axis sharing level, one of ``0``, ``1``, ``2``, or ``3``. See `~proplot.subplots.subplots` for details.
77+
``small`` Font size for legend text, tick labels, axis labels, and text generated with `~matplotlib.axes.Axes.text`.
78+
``span`` Boolean, toggles spanning axis labels. See `~proplot.subplots.subplots` for details.
79+
``tickdir`` Major and minor tick direction. Must be one of ``out``, ``in``, or ``inout``.
80+
``ticklen`` Length of major ticks in points.
81+
``ticklenratio`` Ratio of minor tickline length to major tickline length.
82+
``tickpad`` Padding between ticks and tick labels in points.
83+
``titlepad`` Padding between the axes and the title, alias for :rcraw:`axes.titlepad`.
84+
``tickratio`` Ratio of minor tickline width to major tickline width.
85+
``tight`` Boolean, indicates whether to auto-adjust figure bounds and subplot spacings.
86+
================ ==============================================================================================================================================================================================================================================
87+
88+
rcParamsLong
89+
------------
90+
These are **longer, specific** setting names
91+
used to customize things not covered by
92+
`~matplotlib.rcParams`.
8693

87-
rcParamsCustom
88-
--------------
8994
The ``subplots`` category controls the default layout for figures
9095
and axes. The ``abc``, ``title``, and ``tick`` categories control
9196
a-b-c label, title, and axis tick label settings. The
@@ -95,7 +100,6 @@ categories control figure title and edge label settings.
95100
There are two new additions to the ``image`` category, and the new
96101
``colorbar`` category controls *inset* and *outer*
97102
`~proplot.axes.Axes.colorbar` properties.
98-
99103
The new ``gridminor`` category controls minor gridline settings,
100104
and the new ``geogrid`` category controls meridian and parallel line settings
101105
for `~proplot.axes.ProjAxes`. For both ``gridminor`` and ``geogrid``, if
@@ -180,4 +184,3 @@ is shown below. The syntax is roughly the same as that used for
180184

181185
.. include:: ../proplot/.proplotrc
182186
:literal:
183-

docs/customizing.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"raw_mimetype": "text/restructuredtext"
6262
},
6363
"source": [
64-
"A special object named `~proplot.rctools.rc` is created whenever you import ProPlot. This is your one-stop shop for changing default settings. `~proplot.rctools.rc` can be used to change matplotlib `rcParams <https://matplotlib.org/users/customizing.html>`__ settings, custom ProPlot :ref:`rcParamsCustom` settings, and special :ref:`rcParamsShort` meta-settings. See :ref:`Configuring proplot` for details.\n",
64+
"A special object named `~proplot.rctools.rc` is created whenever you import ProPlot. This is your one-stop shop for changing default settings. `~proplot.rctools.rc` can be used to change matplotlib `rcParams <https://matplotlib.org/users/customizing.html>`__ settings, custom ProPlot :ref:`rcParamsLong` settings, and special :ref:`rcParamsShort` meta-settings. See :ref:`Configuring proplot` for details.\n",
6565
"\n",
6666
"To modify a setting for just one subplot, pass it to the `~proplot.axes.Axes.format` command. To reset everything to the default state, use `~proplot.rctools.rc_configurator.reset`. To temporarily modify global settings for a block of code, use `~proplot.rctools.rc_configurator.context`."
6767
]

docs/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Why didn't you add to matplotlib directly?
2525

2626
Since ProPlot is built right into the matplotlib API, you might be wondering why we didn't contribute to the matplotlib project directly.
2727

28-
* Certain features directly conflict with matplotlib. For example, ProPlot's tight layout algorithm conflicts with matplotlib's `tight layout <https://matplotlib.org/tutorials/intermediate/tight_layout_guide.html>`__ by permitting *fluid figure dimensions*, and the `~proplot.subplots.FlexibleGridSpec` class permits *variable spacing* between rows and columns and uses *physical units* rather than figure-relative and axes-relative units.
28+
* Certain features directly conflict with matplotlib. For example, ProPlot's tight layout algorithm conflicts with matplotlib's `tight layout <https://matplotlib.org/tutorials/intermediate/tight_layout_guide.html>`__ by permitting *fluid figure dimensions*, and the new `~proplot.subplots.GridSpec` class permits *variable spacing* between rows and columns and uses *physical units* rather than figure-relative and axes-relative units.
2929
* Certain features are arguably be too redundant. For example, `~proplot.axes.Axes.format` is convenient, but the same tasks can be accomplished with existing axes and axis "setter" methods. Also, some of the functionality of `~proplot.subplots.subplots` can be replicated with `axes_grid1 <https://matplotlib.org/mpl_toolkits/axes_grid1/index.html>`__. Following `TOOWTDI <https://wiki.python.org/moin/TOOWTDI>`__ philosophy, these features should probably not be integrated.
3030

3131
..

0 commit comments

Comments
 (0)