@@ -49,7 +49,7 @@ See :doc:`/gallery/subplots_axes_and_figures/subfigures` for further details.
4949 subfigs = fig.subfigures(1, 2, wspace=0.07)
5050
5151 axsLeft = subfigs[0].subplots(1, 2, sharey=True)
52- subfigs[0].set_facecolor('0.75 ')
52+ subfigs[0].set_facecolor('#eee ')
5353 for ax in axsLeft:
5454 pc = example_plot(ax)
5555 subfigs[0].suptitle('Left plots', fontsize='x-large')
@@ -125,14 +125,29 @@ Plotting methods
125125
126126`~.Axes.axline ` now supports the *transform * parameter, which applies to the
127127points *xy1 *, *xy2 *. The *slope * (if given) is always in data coordinates.
128- This can be used e.g. with ``ax.transAxes `` for drawing grid lines with a fixed
129- slope.
128+
129+ For example, this can be used with ``ax.transAxes `` for drawing lines with a
130+ fixed slope. In the following plot, the line appears through the same point on
131+ both Axes, even though they show different data limits.
132+
133+ .. plot ::
134+ :include-source:
135+
136+ fig, axs = plt.subplots(1, 2)
137+
138+ for i, ax in enumerate(axs):
139+ ax.axline((0.25, 0), slope=2, transform=ax.transAxes)
140+ ax.set(xlim=(i, i+5), ylim=(i, i+5))
130141
131142New automatic labeling for bar charts
132143-------------------------------------
133144
134145A new `.Axes.bar_label ` method has been added for auto-labeling bar charts.
135- See :doc: `/gallery/lines_bars_and_markers/bar_label_demo ` for examples.
146+
147+ .. figure :: /gallery/lines_bars_and_markers/images/sphx_glr_bar_label_demo_001.png
148+ :target: /gallery/lines_bars_and_markers/bar_label_demo.html
149+
150+ Example of the new automatic labeling.
136151
137152A list of hatches can be specified to `~.axes.Axes.bar ` and `~.axes.Axes.barh `
138153------------------------------------------------------------------------------
@@ -171,7 +186,7 @@ cycler are not explicitly passed.
171186For example, the following will cycle through the line styles:
172187
173188.. plot ::
174- :include-source: True
189+ :include-source:
175190
176191 x = np.arange(0.1, 4, 0.5)
177192 y = np.exp(-x)
@@ -428,6 +443,37 @@ The `matplotlib.colors.Colormap` object now has image representations for
428443IPython / Jupyter backends. Cells returning a colormap on the last line will
429444display an image of the colormap.
430445
446+ .. only :: html
447+
448+ .. code-block ::
449+
450+ In[1]: cmap = plt.get_cmap('viridis').with_extremes(bad='r', under='g', over='b')
451+
452+ In[2]: cmap
453+ Out[2]:
454+
455+ .. raw :: html
456+
457+ <div style =" vertical-align : middle ;" >
458+ <strong >viridis</strong >
459+ </div >
460+ <div class =" cmap" >
461+ <img alt="viridis colormap" title="viridis" style="border: 1px solid #555;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAFnRFWHRUaXRsZQB2aXJpZGlzIGNvbG9ybWFwrE0mCwAAABx0RVh0RGVzY3JpcHRpb24AdmlyaWRpcyBjb2xvcm1hcAtjl3IAAABKdEVYdEF1dGhvcgBNYXRwbG90bGliIHYzLjQuMHJjMy5wb3N0OS5kZXYwK2czZTQzMThmMjgwLCBodHRwczovL21hdHBsb3RsaWIub3JndvlliwAAAEx0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My40LjByYzMucG9zdDkuZGV2MCtnM2U0MzE4ZjI4MCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ9pNs1oAAAIiSURBVHic7dZBkpswFEXRL9halpD9LyX0IDIUAhnHldk7Z+KS9BFUD7pu+9V+b1VV1Vr9/V36z3ldfd1ec0vfH9bH+f3z43su987uv9x7/7s9nM+e3/bz+vK8Tvfv863u54b7xvnrerx/dm8Nzw33LA/nl+ffv+d5/en99+tv3/O/73+cq/dzn+9v3z1fT/PbV98xnh9zk/P9O2bPv99vk7l2WQ/P1Tg3/Fubrh/2+73LZX7r+zWsx/P7e2Zz+289nA9zS/vz4dx5fv3n8/N71rp/77i/vp6rh/XrvcP7ruv77zjuPX//MX++7zo/vG+2P3zH7HvXGv8u57/netmvvl/n9b7fhv2+7vv7uk8c80v/7XNtOd0DAAQRAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQKAfbnCJh8XCmbQAAAAASUVORK5CYII=">
462+ </div >
463+ <div style =" vertical-align : middle ; max-width : 514px ; display : flex ; justify-content : space-between ;" >
464+ <div style =" float : left ;" >
465+ <div title =" #008000ff" style =" display : inline-block ; width : 1em ; height : 1em ; margin : 0 ; vertical-align : middle ; border : 1px solid #555 ; background-color : #008000ff ;" ></div >
466+ under
467+ </div >
468+ <div style =" margin : 0 auto ; display : inline-block ;" >
469+ bad
470+ <div title =" #ff0000ff" style =" display : inline-block ; width : 1em ; height : 1em ; margin : 0 ; vertical-align : middle ; border : 1px solid #555 ; background-color : #ff0000ff ;" ></div >
471+ </div >
472+ <div style =" float : right ;" >
473+ over
474+ <div title =" #0000ffff" style =" display : inline-block ; width : 1em ; height : 1em ; margin : 0 ; vertical-align : middle ; border : 1px solid #555 ; background-color : #0000ffff ;" ></div >
475+ </div >
476+
431477``Colormap.set_extremes `` and ``Colormap.with_extremes ``
432478--------------------------------------------------------
433479
@@ -533,8 +579,18 @@ labels for Axes not in the last row. This behavior is incorrect if rcParams
533579specify that Axes should be labeled on the top (``rcParams["xtick.labeltop"] =
534580True ``) or on the right (``rcParams["ytick.labelright"] = True ``).
535581
536- Such cases are now handled correctly (adjusting visibility as needed on the
537- first row and last column of axes).
582+ Cases such as the following are now handled correctly (adjusting visibility as
583+ needed on the first row and last column of Axes):
584+
585+ .. plot ::
586+ :include-source:
587+
588+ plt.rcParams["xtick.labelbottom"] = False
589+ plt.rcParams["xtick.labeltop"] = True
590+ plt.rcParams["ytick.labelleft"] = False
591+ plt.rcParams["ytick.labelright"] = True
592+
593+ fig, axs = plt.subplots(2, 2, sharex=True, sharey=True)
538594
539595An iterable object with labels can be passed to `.Axes.plot `
540596------------------------------------------------------------
@@ -544,6 +600,7 @@ When plotting multiple datasets by passing 2D data as *y* value to
544600matching the number of columns in *y *.
545601
546602.. plot ::
603+ :include-source:
547604
548605 x = [1, 2, 3]
549606
@@ -564,6 +621,11 @@ Text transform can rotate text direction
564621The new `.Text ` parameter ``transform_rotates_text `` now sets whether rotations
565622of the transform affect the text direction.
566623
624+ .. figure :: /gallery/text_labels_and_annotations/images/sphx_glr_text_rotation_relative_to_line_001.png
625+ :target: /gallery/text_labels_and_annotations/text_rotation_relative_to_line.html
626+
627+ Example of the new *transform_rotates_text * parameter
628+
567629``matplotlib.mathtext `` now supports *overset * and *underset * LaTeX symbols
568630---------------------------------------------------------------------------
569631
@@ -598,7 +660,7 @@ trying to pick ticks at set intervals (i.e., day 1 and 15 of the month), versus
598660evenly spaced ticks that start wherever the timeseries starts:
599661
600662.. plot ::
601- :include-source: True
663+ :include-source:
602664
603665 dates = np.arange('2001-01-10', '2001-05-23', dtype='datetime64[D]')
604666 y = np.sin(dates.astype(float) / 10)
@@ -676,6 +738,9 @@ The errorbar function `.Axes.errorbar` is ported into the 3D Axes framework in
676738its entirety, supporting features such as custom styling for error lines and
677739cap marks, control over errorbar spacing, upper and lower limit marks.
678740
741+ .. figure :: /gallery/mplot3d/images/sphx_glr_errorbar3d_001.png
742+ :target: /gallery/mplot3d/errorbar3d.html
743+
679744Stem plots in 3D Axes
680745---------------------
681746
@@ -725,6 +790,15 @@ New ``RangeSlider`` widget
725790`.widgets.RangeSlider ` allows for creating a slider that defines
726791a range rather than a single value.
727792
793+ .. plot ::
794+
795+ fig, ax = plt.subplots(2, 1, figsize=(5, 1))
796+ fig.subplots_adjust(left=0.2, right=0.8)
797+
798+ from matplotlib.widgets import Slider, RangeSlider
799+ Slider(ax[0], 'Slider', 0, 1)
800+ RangeSlider(ax[1], 'RangeSlider', 0, 1)
801+
728802Sliders can now snap to arbitrary values
729803----------------------------------------
730804
@@ -736,9 +810,9 @@ Pausing and Resuming Animations
736810-------------------------------
737811
738812The `.animation.Animation.pause ` and `.animation.Animation.resume ` methods
739- allow you to pause and resume animations. These methods can be used as callbacks
740- for event listeners on UI elements so that your plots can have some playback
741- control UI.
813+ allow you to pause and resume animations. These methods can be used as
814+ callbacks for event listeners on UI elements so that your plots can have some
815+ playback control UI.
742816
743817
744818Backend-specific improvements
0 commit comments