Skip to content

Commit cebc74e

Browse files
committed
Why proplot
1 parent e43db85 commit cebc74e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

docs/why.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This massively reduces the amount of code needed to create highly customized fig
3838
ax.format(linewidth=1, color='gray')
3939
ax.format(xticks=20, xtickminor=True, xlabel='x axis', ylabel='y axis')
4040
41-
is much more succinct than
41+
...is much more succinct than
4242

4343
.. code-block:: python
4444
@@ -54,6 +54,7 @@ is much more succinct than
5454
ax.set_xlabel('x axis', color='gray')
5555
ax.set_ylabel('y axis', color='gray')
5656
57+
5758
Constructor functions
5859
=====================
5960
.. raw:: html
@@ -105,7 +106,7 @@ Matplotlib has a `tight layout <https://matplotlib.org/tutorials/intermediate/ti
105106

106107
<h3>Solution</h3>
107108

108-
In ProPlot, you can specify the physical dimensions of *subplots* instead of the figure by passing `axwidth` or `axheight` to `~proplot.subplots.Figure`. The default behavior is ``axwidth=2`` (inches). Figure dimensions are then automatically calculated to accommodate the subplot geometry and the spacing adjustments.
109+
In ProPlot, you can specify the physical dimensions of *subplots* instead of the figure by passing `axwidth`, `axheight`, and/or `aspect` to `~proplot.subplots.Figure`. The default behavior is ``axwidth=2`` (inches) with ``aspect=1``. Figure dimensions are then automatically calculated to accommodate the subplot geometry and the spacing adjustments.
109110

110111
..
111112
Several matplotlib backends require figure dimensions to be fixed. When `~proplot.subplots.Figure.draw` changes the figure dimensions, this can "surprise" the backend and cause unexpected behavior. ProPlot fixes this issue for the static inline backend and the Qt popup backend. However, this issue is unfixable the "notebook" inline backend, the "macosx" popup backend, and possibly other untested backends.
@@ -159,8 +160,8 @@ individual subplots and along contiguous subplots on the edge of the figure:
159160
* Outer colorbars and legends don't mess up the subplot layout or subplot aspect ratios, since the new `~proplot.subplots.FlexibleGridSpec` class permits variable spacing between subplot rows and columns. This is critical e.g. if you have a colorbar between columns 1 and 2 but nothing between columns 2 and 3.
160161
* The width of colorbars are now specified in physical units. This makes it easier to get the thickness just right, and makes thickness independent of figure size.
161162

162-
A useful axes container
163-
=======================
163+
The axes container class
164+
========================
164165

165166
..
166167
The `~matplotlib.pyplot.subplots` command is useful for generating a scaffolding of * axes all at once. This is generally faster than successive `~matplotlib.subplots.Figure.add_subplot` commands.
@@ -181,7 +182,7 @@ In ProPlot, `~proplot.subplots.subplots` returns an `~proplot.subplots.axes_grid
181182
* `~proplot.subplots.axes_grid` supports row-major or column-major 1D indexing, e.g. ``axs[0]``. The order can be changed by passing ``order='F'`` or ``order='C'`` to `~proplot.subplots.subplots`.
182183
* `~proplot.subplots.axes_grid` permits 2D indexing, e.g. ``axs[1,0]``. Since `~proplot.subplots.subplots` can generate figures with arbitrarily complex subplot geometry, this 2D indexing is useful only when the arrangement happens to be a clean 2D matrix.
183184

184-
Further, thanks to the `~proplot.subplots.axes_grid.__getattr__` override, `~proplot.subplots.axes_grid` allows you to call arbitrary methods on arbitrary axes all at once, e.g. ``axs.format(tickminor=False)``.
185+
Further, `~proplot.subplots.axes_grid` allows you to call arbitrary methods on arbitrary axes all at once, e.g. ``axs.format(tickminor=False)``. This goes with ProPlot's theme of preserving the object-oriented spirit, but making things easier for users.
185186

186187
Xarray and pandas integration
187188
=============================

proplot/subplots.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def __setitem__(self, key, value):
104104
raise LookupError('axes_grid is immutable.')
105105

106106
def __getitem__(self, key):
107-
"""If an integer is passed, the item is returned, and if a slice is passed,
108-
an `axes_grid` of the items is returned. You can also use 2D indexing,
109-
and the corresponding axes in the axes grid will be chosen.
107+
"""If an integer is passed, the item is returned, and if a slice is
108+
passed, an `axes_grid` of the items is returned. You can also use 2D
109+
indexing, and the corresponding axes in the axes grid will be chosen.
110110
111111
Example
112112
-------

0 commit comments

Comments
 (0)