Skip to content

Commit 4fc0686

Browse files
committed
Colorbars and legends descrip
1 parent cbb29c5 commit 4fc0686

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

docs/colorbars_legends.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"## Axes colorbars and legends"
14+
"## Axes colorbars and legends\n",
15+
"ProPlot includes some *awesome* improvements to the default API for working with colorbars and legends to make your life easier."
1516
]
1617
},
1718
{
@@ -20,9 +21,9 @@
2021
"raw_mimetype": "text/restructuredtext"
2122
},
2223
"source": [
23-
"Drawing colorbars and legends is a much smoother experience with ProPlot. To draw a colorbar or legend along the outside of an axes, use the `~proplot.axes.Axes.colorbar` and `~proplot.axes.Axes.legend` `~proplot.axes.Axes` methods with e.g. ``loc='right'``. If you do this multiple times, the colorbars and legends will be \"stacked\". Room for colorbars and legends is allocated from the space between subplot rows and columns -- it is no longer stolen from the axes.\n",
24+
"With ProPlot, you can draw a colorbar or legend along the *outside edge* of a subplot with the `~proplot.axes.Axes.colorbar` and `~proplot.axes.Axes.legend` `~proplot.axes.Axes` methods by selecting an edge location, e.g. ``loc='right'``. If you add multiple colorbars and legends to the same side, they will be *stacked* automatically. The space for outer colorbars and legends is allocated from the space between subplot rows and columns -- it is no longer stolen from the axes.\n",
2425
"\n",
25-
"To plot data and draw a colorbar in one go, pass an *outer* location, e.g. ``colorbar='r'`` to methods that accept a `cmap` argument. To draw a legend or colorbar-legend in one go, pass an *outer* location, e.g. ``legend='r'`` or ``colorbar='r'``, to methods that accept a `cycle` argument. These are powered by the `~proplot.wrappers.cmap_changer` and `~proplot.wrappers.cycle_changer` wrappers.\n",
26+
"You can also use ProPlot to draw colorbars and legends on-the-fly. To plot data and draw a colorbar in one go, pass a location (e.g. ``colorbar='r'``) to methods that accept a `cmap` argument. To draw a legend or colorbar-legend in one go, pass a location (e.g. ``legend='r'`` or ``colorbar='r'``) to methods that accept a `cycle` argument. These are powered by the `~proplot.wrappers.cmap_changer` and `~proplot.wrappers.cycle_changer` wrappers.\n",
2627
"\n",
2728
"To draw an *inset* colorbar, pass an *inset* location, e.g. ``colorbar='upper right'`` or ``colorbar='ur'``, to methods that accept a `cmap` or `cycle` argument. Inset colorbars have optional rectangular backgrounds, just like inset legends."
2829
]

docs/why.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Matplotlib has a `tight layout <https://matplotlib.org/tutorials/intermediate/ti
138138

139139
.. rubric:: Solution
140140

141-
In ProPlot, you can specify the physical dimensions of a *reference subplot* instead of the figure by passing `axwidth`, `axheight`, and/or `aspect` to `~proplot.subplots.Figure`. The default behavior is ``aspect=1`` and ``axwidth=2`` (inches). If the `aspect ratio mode <https://matplotlib.org/2.0.2/examples/pylab_examples/equal_aspect_ratio.html>`__ for the reference subplot is set to ``'equal'``, as with :ref:`Geographic and polar plots` and `~matplotlib.axes.Axes.imshow` plots, the existing aspect will be used instead.
141+
In ProPlot, you can specify the physical dimensions of a *reference subplot* instead of the figure by passing `axwidth`, `axheight`, and/or `aspect` to `~proplot.subplots.Figure`. The default behavior is ``aspect=1`` and ``axwidth=2`` (inches). If the `aspect ratio mode <https://matplotlib.org/2.0.2/examples/pylab_examples/equal_aspect_ratio.html>`__ for the reference subplot is set to ``'equal'``, as with :ref:`Geographic and polar plots` and `~matplotlib.axes.Axes.imshow` plots, the *imposed* aspect ratio will be used instead.
142142
Figure dimensions are constrained as follows:
143143

144144
* When `axwidth` or `axheight` are specified, the figure width and height are calculated automatically.

proplot/subplots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def _preprocess(self, *args, **kwargs):
507507
fig._adjust_aspect() # resizes figure
508508
if fig._auto_tight_layout:
509509
fig._align_axislabels(False) # get proper label offset only
510-
fig._align_labels(renderer) # position labels and suptitle
510+
fig._align_labels(renderer) # position labels and suptitle
511511
fig._adjust_tight_layout(renderer)
512512
fig._align_axislabels(True) # slide spanning labels across
513513
fig._align_labels(renderer) # update figure-relative coordinates!

0 commit comments

Comments
 (0)