Skip to content

Commit bff0f32

Browse files
authored
Merge pull request #24934 from ksunden/rm_ipy_directive
Swap ipython directives for code-block directives
2 parents 038e805 + 8767419 commit bff0f32

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

tutorials/colors/colormapnorms.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@
2020
Artists that map data to color pass the arguments *vmin* and *vmax* to
2121
construct a :func:`matplotlib.colors.Normalize` instance, then call it:
2222
23-
.. ipython::
23+
.. code-block:: pycon
2424
25-
In [1]: import matplotlib as mpl
26-
27-
In [2]: norm = mpl.colors.Normalize(vmin=-1, vmax=1)
28-
29-
In [3]: norm(0)
30-
Out[3]: 0.5
25+
>>> import matplotlib as mpl
26+
>>> norm = mpl.colors.Normalize(vmin=-1, vmax=1)
27+
>>> norm(0)
28+
0.5
3129
3230
However, there are sometimes cases where it is useful to map data to
3331
colormaps in a non-linear fashion.
@@ -192,15 +190,12 @@
192190
# lower out-of-bounds values to the range over which the colors are
193191
# distributed. For instance:
194192
#
195-
# .. ipython::
196-
#
197-
# In [2]: import matplotlib.colors as colors
198-
#
199-
# In [3]: bounds = np.array([-0.25, -0.125, 0, 0.5, 1])
200-
#
201-
# In [4]: norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4)
193+
# .. code-block:: pycon
202194
#
203-
# In [5]: print(norm([-0.2, -0.15, -0.02, 0.3, 0.8, 0.99]))
195+
# >>> import matplotlib.colors as colors
196+
# >>> bounds = np.array([-0.25, -0.125, 0, 0.5, 1])
197+
# >>> norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4)
198+
# >>> print(norm([-0.2, -0.15, -0.02, 0.3, 0.8, 0.99]))
204199
# [0 0 1 2 3 3]
205200
#
206201
# Note: Unlike the other norms, this norm returns values from 0 to *ncolors*-1.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy