From 87674191effa5dbc08fa0fa1b604a17f3b3c1ee4 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Tue, 10 Jan 2023 16:04:16 -0600 Subject: [PATCH] Swap ipython directives for code-block directives --- tutorials/colors/colormapnorms.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/tutorials/colors/colormapnorms.py b/tutorials/colors/colormapnorms.py index caa6bb35f9b7..e7ca0e61bfc7 100644 --- a/tutorials/colors/colormapnorms.py +++ b/tutorials/colors/colormapnorms.py @@ -20,14 +20,12 @@ Artists that map data to color pass the arguments *vmin* and *vmax* to construct a :func:`matplotlib.colors.Normalize` instance, then call it: -.. ipython:: +.. code-block:: pycon - In [1]: import matplotlib as mpl - - In [2]: norm = mpl.colors.Normalize(vmin=-1, vmax=1) - - In [3]: norm(0) - Out[3]: 0.5 + >>> import matplotlib as mpl + >>> norm = mpl.colors.Normalize(vmin=-1, vmax=1) + >>> norm(0) + 0.5 However, there are sometimes cases where it is useful to map data to colormaps in a non-linear fashion. @@ -192,15 +190,12 @@ # lower out-of-bounds values to the range over which the colors are # distributed. For instance: # -# .. ipython:: -# -# In [2]: import matplotlib.colors as colors -# -# In [3]: bounds = np.array([-0.25, -0.125, 0, 0.5, 1]) -# -# In [4]: norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4) +# .. code-block:: pycon # -# In [5]: print(norm([-0.2, -0.15, -0.02, 0.3, 0.8, 0.99])) +# >>> import matplotlib.colors as colors +# >>> bounds = np.array([-0.25, -0.125, 0, 0.5, 1]) +# >>> norm = colors.BoundaryNorm(boundaries=bounds, ncolors=4) +# >>> print(norm([-0.2, -0.15, -0.02, 0.3, 0.8, 0.99])) # [0 0 1 2 3 3] # # Note: Unlike the other norms, this norm returns values from 0 to *ncolors*-1. 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