@@ -18,6 +18,12 @@ values is a single line of python
1818 See :ref: `customizing-with-matplotlibrc-files ` for details about how to
1919persistently and selectively revert many of these changes.
2020
21+ .. contents :: Table of Contents
22+ :depth: 2
23+ :local:
24+ :backlinks: entry
25+
26+
2127
2228colors, color cycles, and color maps
2329====================================
@@ -100,7 +106,6 @@ in your :file:`matplotlibrc` file.
100106Colormap
101107--------
102108
103-
104109The new default color map used by `matplotlib.cm.ScalarMappable ` instances is
105110 `'viridis' ` (aka `option D <http://bids.github.io/colormap/ >`__).
106111
@@ -111,10 +116,16 @@ The new default color map used by `matplotlib.cm.ScalarMappable` instances is
111116 X, Y = np.ogrid[0:20:N*1j, 0:20:M*1j]
112117 data = np.sin(np.pi * X*2 / 20) * np.cos(np.pi * Y*2 / 20)
113118
114- fig, ax = plt.subplots()
115- im = ax.imshow(data, extent=[0, 200, 0, 200])
116- fig.colorbar(im)
117- ax.set_title('viridis')
119+ fig, (ax2, ax1) = plt.subplots(1, 2, figsize=(7, 3))
120+ im = ax1.imshow(data, extent=[0, 200, 0, 200])
121+ ax1.set_title("v2.0: 'viridis'")
122+ fig.colorbar(im, ax=ax1, shrink=.9)
123+
124+ im2 = ax2.imshow(data, extent=[0, 200, 0, 200], cmap='jet')
125+ fig.colorbar(im2, ax=ax2, shrink=.9)
126+ ax2.set_title("classic: 'jet'")
127+
128+ fig.tight_layout()
118129
119130For an introduction to color theory and how 'viridis' was generated
120131watch Nathaniel Smith and Stéfan van der Walt's talk from SciPy2015.
@@ -142,28 +153,119 @@ or setting
142153
143154 in your :file: `matplotlibrc ` file, however this is strongly discouraged.
144155
145- Other colors
146- ------------
156+ Interactive figures
157+ -------------------
158+
159+ The default interactive figure background color has changed from grey
160+ to white, which matches the default background color used when saving.
147161
148- - The default interactive figure background color has changed from
149- grey to white. Use the rcParam ``figure.facecolor `` to control
150- this.
162+ The previous defaults can be restored by ::
163+
164+ mpl.rcParams['figure.facecolor'] = '0.75'
165+
166+ or setting ::
167+
168+
169+ figure.facecolor : '0.75'
170+
171+ in your :file: `matplotlibrc ` file.
151172
152173Grid lines
153174----------
154175
176+ The default style of grid lines was changed from, black dashed lines to thicker
177+ solid light grey lines.
178+
179+ .. plot ::
180+
181+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
182+
183+ ax1.grid(color='k', linewidth=.5, linestyle=':')
184+ ax1.set_title('classic')
185+
186+ ax2.grid()
187+ ax2.set_title('v2.0')
188+
189+ The previous default can be restored by using::
190+
191+ mpl.rcParams['grid.color'] = 'k'
192+ mpl.rcParams['grid.linestyle'] = ':'
193+ mpl.rcParams['grid.linewidth'] = 0.5
194+
195+ or setting::
196+
197+ grid.color : k # grid color
198+ grid.linestyle : : # dotted
199+ grid.linewidth : 0.5 # in points
200+
201+ in your :file: `matplotlibrc ` file.
155202
156- - Grid lines are light grey solid 1pt lines. They are no longer dashed by
157- default.
203+ Plotting functions
204+ ==================
158205
159- Plots
206+ ``scatter ``
207+ -----------
208+
209+ The following changes were made to the default behavior of `~matplotlib.axes.Axes.scatter `
210+
211+ - The default size of the elements in a scatter plot is now based on
212+ the rcParam ``lines.markersize `` so it is consistent with ``plot(X,
213+ Y, 'o') ``. The old value was 20, and the new value is 36 (6^2).
214+ - scatter markers no longer have a black edge.
215+ - if the color of the markers is not specified it will follow the property cycle
216+ pulling from the 'patches' cycle on the ``Axes ``.
217+
218+ .. plot ::
219+
220+ np.random.seed(2)
221+
222+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
223+
224+ x = np.arange(15)
225+ y = np.random.rand(15)
226+ y2 = np.random.rand(15)
227+ ax1.scatter(x, y, s=20, edgecolors='k', c='b', label='a')
228+ ax1.scatter(x, y2, s=20, edgecolors='k', c='b', label='b')
229+ ax1.legend()
230+ ax1.set_title('classic')
231+
232+ ax2.scatter(x, y, label='a')
233+ ax2.scatter(x, y2, label='b')
234+ ax2.legend()
235+ ax2.set_title('v2.0')
236+
237+
238+ The classic default behavior of `~matplotlib.axes.Axes.scatter ` can
239+ only be recovered through ``mpl.style.use('classic') ``. The marker size
240+ can be recovered via ::
241+
242+ mpl.rcParam['lines.markersize'] = np.sqrt(20)
243+
244+ however, this will also affect the default marker size of
245+ `~matplotlib.axes.Axes.plot `. To recover the classic behavior on
246+ a per-call basis pass the following kwargs::
247+
248+ classic_kwargs = {'s': 20, 'edgecolors': 'k', 'c': 'b'}
249+
250+ ``plot ``
251+ --------
252+
253+ The following changes were made to the default behavior of
254+ `~matplotlib.axes.Axes.plot `
255+
256+ - the default linewidth change from 1 to 1.5
257+ - the dash patterns associated with ``'--' ``, ``':' ``, and ``'-.' `` have
258+ changed
259+ - the dash patterns now scale with line width.
260+
261+
262+
263+ Other
160264=====
265+
161266- For markers, scatter plots, bar charts and pie charts, there is no
162267 longer a black outline around filled markers by default.
163-
164- - The default size of the elements in a scatter plot is now based on
165- the rcParam ``lines.markersize `` so it is consistent with ``plot(X,
166- Y, 'o') ``. The old value was 20, and the new value is 36 (6^2).
268+ - lines.color change, only hits raw usage of Line2D
167269
168270Hatching
169271========
0 commit comments