@@ -49,7 +49,7 @@ See :doc:`/gallery/subplots_axes_and_figures/subfigures` for further details.
49
49
subfigs = fig.subfigures(1, 2, wspace=0.07)
50
50
51
51
axsLeft = subfigs[0].subplots(1, 2, sharey=True)
52
- subfigs[0].set_facecolor('0.75 ')
52
+ subfigs[0].set_facecolor('#eee ')
53
53
for ax in axsLeft:
54
54
pc = example_plot(ax)
55
55
subfigs[0].suptitle('Left plots', fontsize='x-large')
@@ -125,14 +125,29 @@ Plotting methods
125
125
126
126
`~.Axes.axline ` now supports the *transform * parameter, which applies to the
127
127
points *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))
130
141
131
142
New automatic labeling for bar charts
132
143
-------------------------------------
133
144
134
145
A 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.
136
151
137
152
A list of hatches can be specified to `~.axes.Axes.bar ` and `~.axes.Axes.barh `
138
153
------------------------------------------------------------------------------
@@ -171,7 +186,7 @@ cycler are not explicitly passed.
171
186
For example, the following will cycle through the line styles:
172
187
173
188
.. plot ::
174
- :include-source: True
189
+ :include-source:
175
190
176
191
x = np.arange(0.1, 4, 0.5)
177
192
y = np.exp(-x)
@@ -428,6 +443,37 @@ The `matplotlib.colors.Colormap` object now has image representations for
428
443
IPython / Jupyter backends. Cells returning a colormap on the last line will
429
444
display an image of the colormap.
430
445
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
+
431
477
``Colormap.set_extremes `` and ``Colormap.with_extremes ``
432
478
--------------------------------------------------------
433
479
@@ -533,8 +579,18 @@ labels for Axes not in the last row. This behavior is incorrect if rcParams
533
579
specify that Axes should be labeled on the top (``rcParams["xtick.labeltop"] =
534
580
True ``) or on the right (``rcParams["ytick.labelright"] = True ``).
535
581
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)
538
594
539
595
An iterable object with labels can be passed to `.Axes.plot `
540
596
------------------------------------------------------------
@@ -544,6 +600,7 @@ When plotting multiple datasets by passing 2D data as *y* value to
544
600
matching the number of columns in *y *.
545
601
546
602
.. plot ::
603
+ :include-source:
547
604
548
605
x = [1, 2, 3]
549
606
@@ -564,6 +621,11 @@ Text transform can rotate text direction
564
621
The new `.Text ` parameter ``transform_rotates_text `` now sets whether rotations
565
622
of the transform affect the text direction.
566
623
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
+
567
629
``matplotlib.mathtext `` now supports *overset * and *underset * LaTeX symbols
568
630
---------------------------------------------------------------------------
569
631
@@ -598,7 +660,7 @@ trying to pick ticks at set intervals (i.e., day 1 and 15 of the month), versus
598
660
evenly spaced ticks that start wherever the timeseries starts:
599
661
600
662
.. plot ::
601
- :include-source: True
663
+ :include-source:
602
664
603
665
dates = np.arange('2001-01-10', '2001-05-23', dtype='datetime64[D]')
604
666
y = np.sin(dates.astype(float) / 10)
@@ -676,6 +738,9 @@ The errorbar function `.Axes.errorbar` is ported into the 3D Axes framework in
676
738
its entirety, supporting features such as custom styling for error lines and
677
739
cap marks, control over errorbar spacing, upper and lower limit marks.
678
740
741
+ .. figure :: /gallery/mplot3d/images/sphx_glr_errorbar3d_001.png
742
+ :target: /gallery/mplot3d/errorbar3d.html
743
+
679
744
Stem plots in 3D Axes
680
745
---------------------
681
746
@@ -725,6 +790,15 @@ New ``RangeSlider`` widget
725
790
`.widgets.RangeSlider ` allows for creating a slider that defines
726
791
a range rather than a single value.
727
792
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
+
728
802
Sliders can now snap to arbitrary values
729
803
----------------------------------------
730
804
@@ -736,9 +810,9 @@ Pausing and Resuming Animations
736
810
-------------------------------
737
811
738
812
The `.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.
742
816
743
817
744
818
Backend-specific improvements
0 commit comments