Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 251ae73

Browse files
committed
DOC: update colormap section
1 parent 534778f commit 251ae73

File tree

1 file changed

+60
-18
lines changed

1 file changed

+60
-18
lines changed

doc/users/dflt_style_changes.rst

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ default style.
88
While it is impossible to select the best default for all cases, these
99
are designed to work well in the most common cases.
1010

11-
A 'classic' style sheet will be provided so reverting to the 1.x
12-
default values will be a single line of python
11+
A 'classic' style sheet is provided so reverting to the 1.x default
12+
values is a single line of python
1313

1414
.. code::
1515
1616
mpl.style.use('classic')
1717
18+
See :ref:`customizing-with-matplotlibrc-files` for details about how to
19+
persistently and selectively revert many of these changes.
20+
1821

1922
colors, color cycles, and color maps
2023
====================================
@@ -79,45 +82,84 @@ colors. This allows the first 10 colors in
7982
``mpl.rcParms['axes.prop_cycle']`` to be easily accessed. See
8083
:ref:`colors` for more details.
8184

85+
To restore only the old color cycle use
86+
87+
.. code::
88+
89+
from cycler import cycler
90+
mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')
91+
92+
or setting
93+
94+
.. code::
95+
96+
axes.prop_cycle : cycler('color', 'bgrcmyk')
97+
98+
in your :file:`matplotlibrc` file.
8299

83100
Colormap
84101
--------
85102

86103

87-
``matplotlib`` is changing the default colormap and styles in the
88-
upcoming 2.0 release!
104+
The new default color map used by `matplotlib.cm.ScalarMappable` instances is
105+
`'viridis'` (aka `option D <http://bids.github.io/colormap/>`__).
106+
107+
.. plot::
108+
109+
import numpy as np
110+
N = M = 200
111+
X, Y = np.ogrid[0:20:N*1j, 0:20:M*1j]
112+
data = np.sin(np.pi * X*2 / 20) * np.cos(np.pi * Y*2 / 20)
113+
114+
fig, ax = plt.subplots()
115+
im = ax.imshow(data, extent=[0, 200, 0, 200])
116+
fig.colorbar(im)
117+
ax.set_title('viridis')
89118

90-
The new default color map will be 'viridis' (aka `option
91-
D <http://bids.github.io/colormap/>`_). For an introduction to color
92-
theory and how 'viridis' was generated watch Nathaniel Smith and
93-
Stéfan van der Walt's talk from SciPy2015
119+
For an introduction to color theory and how 'viridis' was generated
120+
watch Nathaniel Smith and Stéfan van der Walt's talk from SciPy2015.
121+
See `here for many more deatils <http://bids.github.io/colormap/>`__
122+
about the other alternatives and the tools used to create the color
123+
map. For details on all of color maps available in matplotlib see
124+
:ref:`colormaps`.
94125

95126
.. raw:: html
96127

97128
<iframe width="560" height="315" src="https://www.youtube.com/embed/xAoljeRJ3lU" frameborder="0" allowfullscreen></iframe>
98129

99130

131+
The previous default can be restored using
132+
133+
.. code::
100134
101-
Other
102-
-----
135+
mpl.rcParams['image.cmap'] = 'jet'
103136
104-
- The default figure background color has changed from grey to white.
105-
Use the rcParam ``figure.facecolor`` to control this.
137+
or setting
106138

107-
- The default cycle of colors to draw lines, markers and other content
108-
has been changed.
139+
.. code::
109140
110-
- The default color map used for images and pcolor meshes, etc., has
111-
changed from ``jet`` to ``viridis``.
141+
image.cmap : 'jet'
142+
143+
in your :file:`matplotlibrc` file, however this is strongly discouraged.
144+
145+
Other colors
146+
------------
147+
148+
- The default interactive figure background color has changed from
149+
grey to white. Use the rcParam ``figure.facecolor`` to control
150+
this.
151+
152+
Grid lines
153+
----------
112154

113-
- For markers, scatter plots, bar charts and pie charts, there is no
114-
longer a black outline around filled markers by default.
115155

116156
- Grid lines are light grey solid 1pt lines. They are no longer dashed by
117157
default.
118158

119159
Plots
120160
=====
161+
- For markers, scatter plots, bar charts and pie charts, there is no
162+
longer a black outline around filled markers by default.
121163

122164
- The default size of the elements in a scatter plot is now based on
123165
the rcParam ``lines.markersize`` so it is consistent with ``plot(X,

0 commit comments

Comments
 (0)