1- Changes to the default style
2- ----------------------------
1+ ==============================
2+ Changes to the default style
3+ ==============================
34
45The most important changes in matplotlib 2.0 are the changes to the
56default style.
67
78While it is impossible to select the best default for all cases, these
89are designed to work well in the most common cases.
910
10- These changes include:
1111
12- Colors
13- ``````
12+
13+ colors, color cycles, and color maps
14+ ====================================
15+
16+ Colors in default property cycle
17+ --------------------------------
18+
19+ The colors in the default proprety cycle have been changed from
20+ ``['b', 'g', 'r', 'c', 'm', 'y', 'k'] `` to the `Vega
21+ category10 palette
22+ <https://github.com/vega/vega/wiki/Scales#scale-range-literals> `__
23+
24+ .. plot ::
25+
26+
27+ th = np.linspace(0, 2*np.pi, 512)
28+
29+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
30+
31+
32+ def color_demo(ax, colors, title):
33+ ax.set_title(title)
34+ for j, c in enumerate(colors):
35+ v_offset = -(j / len(colors))
36+ ax.plot(th, .1*np.sin(th) + v_offset, color=c)
37+ ax.annotate("'C{}'".format(j), (0, v_offset),
38+ xytext=(-1.5, 0),
39+ ha='right',
40+ va='center',
41+ color=c,
42+ textcoords='offset points',
43+ family='monospace')
44+
45+ ax.annotate("{!r}".format(c), (2*np.pi, v_offset),
46+ xytext=(1.5, 0),
47+ ha='left',
48+ va='center',
49+ color=c,
50+ textcoords='offset points',
51+ family='monospace')
52+ ax.axis('off')
53+
54+ old_colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
55+
56+ new_colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
57+ '#9467bd', '#8c564b', '#e377c2', '#7f7f7f',
58+ '#bcbd22', '#17becf']
59+
60+ color_demo(ax1, old_colors, 'classic')
61+ color_demo(ax2, new_colors, 'v2.0')
62+
63+ fig.subplots_adjust(**{'bottom': 0.0, 'left': 0.059, 'right': 0.869, 'top': 0.895})
64+
65+ In addition to changing the colors, an additional method to specify
66+ colors was added. Previously, the default colors were the single
67+ character short-hand notations for red, green, blue, cyan, magenta,
68+ yellow, and black. This made them easy to type and usable in the
69+ abbreviated style string in ``plot ``. On the other hand, the new
70+ colors are only specified via a hex value. To make in easy to access
71+ these colors the notation for colors ``'CN' `` was added to access
72+ colors. This allows the first 10 colors in
73+ ``mpl.rcParms['axes.prop_cycle'] `` to be easily accessed. See
74+ :ref: `colors ` for more details.
75+
76+
77+ Other
78+ -----
1479
1580- The default figure background color has changed from grey to white.
1681 Use the rcParam ``figure.facecolor `` to control this.
1782
1883- The default cycle of colors to draw lines, markers and other content
19- has been changed. It is based on the `Vega category10 palette
20- <https://github.com/vega/vega/wiki/Scales#scale-range-literals> `__.
84+ has been changed.
2185
2286- The default color map used for images and pcolor meshes, etc., has
2387 changed from ``jet `` to ``viridis ``.
@@ -29,14 +93,14 @@ Colors
2993 default.
3094
3195Plots
32- `````
96+ =====
3397
3498- The default size of the elements in a scatter plot is now based on
3599 the rcParam ``lines.markersize `` so it is consistent with ``plot(X,
36100 Y, 'o') ``. The old value was 20, and the new value is 36 (6^2).
37101
38102Hatching
39- ````````
103+ ========
40104
41105- The width of the lines in a hatch pattern is now configurable by the
42106 rcParam `hatch.linewidth `, with a default of 1 point. The old
@@ -48,7 +112,7 @@ Hatching
48112 - Agg: 1 px
49113
50114Plot layout
51- ```````````
115+ ===========
52116
53117- The default dpi used for on-screen is now 100, which is the same as
54118 the old default for saving files. Due to this, the on-screen
@@ -81,7 +145,7 @@ Plot layout
81145 rcParam ``errorbar.capsize `` to control this.
82146
83147Images
84- ``````
148+ ======
85149
86150- The default mode for image interpolation, in the rcParam
87151 ``image.interpolation ``, is now ``nearest ``.
@@ -95,7 +159,7 @@ Images
95159 downsampling of an image.
96160
97161Fonts
98- `````
162+ =====
99163
100164- The default font has changed from "Bitstream Vera Sans" to "DejaVu
101165 Sans". "DejaVu Sans" is an improvement on "Bistream Vera Sans" that
@@ -109,7 +173,7 @@ Fonts
109173 TeX backend is used (i.e. ``text.usetex `` is ``True ``).
110174
111175Dates
112- `````
176+ =====
113177
114178- The default date formats are now all based on ISO format, i.e., with
115179 the slowest-moving value first. The date formatters are still
@@ -118,7 +182,7 @@ Dates
118182 format dates based on the current locale.
119183
120184Legends
121- ```````
185+ =======
122186
123187- By default, the number of points displayed in a legend is now 1.
124188
@@ -129,7 +193,7 @@ Legends
129193- The legend now has rounded corners by default.
130194
131195mplot3d
132- ```````
196+ =======
133197
134198- mplot3d now obeys some style-related rcParams, rather than using
135199 hard-coded defaults. These include:
0 commit comments