You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<divid="unreleased-message"> You are reading an old version of the documentation (v2.0.0). For the latest version see <ahref="https://matplotlib.org/stable/api/colors_api.html">https://matplotlib.org/stable/api/colors_api.html</a></div>
<spanid="matplotlib-colors"></span><h2><aclass="reference internal" href="#module-matplotlib.colors" title="matplotlib.colors"><codeclass="xref py py-mod docutils literal"><spanclass="pre">matplotlib.colors</span></code></a><aclass="headerlink" href="#module-matplotlib.colors" title="Permalink to this headline">¶</a></h2>
<p>A module for converting numbers or color arguments to <em>RGB</em> or <em>RGBA</em></p>
<p><em>RGB</em> and <em>RGBA</em> are sequences of, respectively, 3 or 4 floats in the
range 0-1.</p>
<p>This module includes functions and classes for color specification
conversions, and for mapping numbers to colors in a 1-D array of colors called
a colormap. Colormapping typically involves two steps: a data array is first
mapped onto the range 0-1 using an instance of <aclass="reference internal" href="#matplotlib.colors.Normalize" title="matplotlib.colors.Normalize"><codeclass="xref py py-class docutils literal"><spanclass="pre">Normalize</span></code></a> or of a
subclass; then this number in the 0-1 range is mapped to a color using an
instance of a subclass of <aclass="reference internal" href="#matplotlib.colors.Colormap" title="matplotlib.colors.Colormap"><codeclass="xref py py-class docutils literal"><spanclass="pre">Colormap</span></code></a>. Two are provided here:
<aclass="reference internal" href="#matplotlib.colors.LinearSegmentedColormap" title="matplotlib.colors.LinearSegmentedColormap"><codeclass="xref py py-class docutils literal"><spanclass="pre">LinearSegmentedColormap</span></code></a>, which is used to generate all the built-in
colormap instances, but is also useful for making custom colormaps, and
<aclass="reference internal" href="#matplotlib.colors.ListedColormap" title="matplotlib.colors.ListedColormap"><codeclass="xref py py-class docutils literal"><spanclass="pre">ListedColormap</span></code></a>, which is used for generating a custom colormap from a
list of color specifications.</p>
<p>The module also provides functions for checking whether an object can be
interpreted as a color (<aclass="reference internal" href="#matplotlib.colors.is_color_like" title="matplotlib.colors.is_color_like"><codeclass="xref py py-func docutils literal"><spanclass="pre">is_color_like()</span></code></a>), for converting such an object
to an RGBA tuple (<aclass="reference internal" href="#matplotlib.colors.to_rgba" title="matplotlib.colors.to_rgba"><codeclass="xref py py-func docutils literal"><spanclass="pre">to_rgba()</span></code></a>) or to an HTML-like hex string in the
<codeclass="xref py py-obj docutils literal"><spanclass="pre">#rrggbb</span></code> format (<aclass="reference internal" href="#matplotlib.colors.to_hex" title="matplotlib.colors.to_hex"><codeclass="xref py py-func docutils literal"><spanclass="pre">to_hex()</span></code></a>), and a sequence of colors to an <codeclass="xref py py-obj docutils literal"><spanclass="pre">(n,</span><spanclass="pre">4)</span></code>
RGBA array (<aclass="reference internal" href="#matplotlib.colors.to_rgba_array" title="matplotlib.colors.to_rgba_array"><codeclass="xref py py-func docutils literal"><spanclass="pre">to_rgba_array()</span></code></a>). Caching is used for efficiency.</p>
<p>Commands which take color arguments can use several formats to specify
the colors. For the basic built-in colors, you can use a single letter</p>
<p>(possibly specifying an alpha value as well), or you can pass an <codeclass="xref py py-obj docutils literal"><spanclass="pre">(r,</span><spanclass="pre">g,</span><spanclass="pre">b)</span></code>
or <codeclass="xref py py-obj docutils literal"><spanclass="pre">(r,</span><spanclass="pre">g,</span><spanclass="pre">b,</span><spanclass="pre">a)</span></code> tuple, where each of <codeclass="xref py py-obj docutils literal"><spanclass="pre">r</span></code>, <codeclass="xref py py-obj docutils literal"><spanclass="pre">g</span></code>, <codeclass="xref py py-obj docutils literal"><spanclass="pre">b</span></code> and <codeclass="xref py py-obj docutils literal"><spanclass="pre">a</span></code> are in the range
[0,1].</p>
<p>Finally, legal html names for colors, like ‘red’, ‘burlywood’ and ‘chartreuse’
are supported.</p>
<dlclass="class">
<dtid="matplotlib.colors.BoundaryNorm">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">BoundaryNorm</code><spanclass="sig-paren">(</span><em>boundaries</em>, <em>ncolors</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.BoundaryNorm" title="Permalink to this definition">¶</a></dt>
<aclass="reference internal" href="#matplotlib.colors.BoundaryNorm" title="matplotlib.colors.BoundaryNorm"><codeclass="xref py py-class docutils literal"><spanclass="pre">BoundaryNorm</span></code></a> maps values to integers instead of to the
interval 0-1.</p>
<p>Mapping to the 0-1 interval could have been done via
piece-wise linear interpolation, but using integers seems
simpler, and reduces the number of conversions back and forth
between integer and floating point.</p>
<dlclass="docutils">
<dt><em>boundaries</em></dt>
<dd>a monotonically increasing sequence</dd>
<dt><em>ncolors</em></dt>
<dd>number of colors in the colormap to be used</dd>
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.BoundaryNorm.inverse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.Colormap">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">Colormap</code><spanclass="sig-paren">(</span><em>name</em>, <em>N=256</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Colormap" title="Permalink to this definition">¶</a></dt>
<p>Typically Colormap instances are used to convert data values (floats) from
the interval <codeclass="docutils literal"><spanclass="pre">[0,</span><spanclass="pre">1]</span></code> to the RGBA color that the respective Colormap
represents. For scaling of data into the <codeclass="docutils literal"><spanclass="pre">[0,</span><spanclass="pre">1]</span></code> interval see
<aclass="reference internal" href="#matplotlib.colors.Normalize" title="matplotlib.colors.Normalize"><codeclass="xref py py-class docutils literal"><spanclass="pre">matplotlib.colors.Normalize</span></code></a>. It is worth noting that
<aclass="reference internal" href="cm_api.html#matplotlib.cm.ScalarMappable" title="matplotlib.cm.ScalarMappable"><codeclass="xref py py-class docutils literal"><spanclass="pre">matplotlib.cm.ScalarMappable</span></code></a> subclasses make heavy use of this
<codeclass="descname">colorbar_extend</code><emclass="property"> = None</em><aclass="headerlink" href="#matplotlib.colors.Colormap.colorbar_extend" title="Permalink to this definition">¶</a></dt>
<dd><p>When this colormap exists on a scalar mappable and colorbar_extend
is not False, colorbar creation will pick up <codeclass="docutils literal"><spanclass="pre">colorbar_extend</span></code> as
the default value for the <codeclass="docutils literal"><spanclass="pre">extend</span></code> keyword in the
<codeclass="descname">is_gray</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Colormap.is_gray" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.Colormap.set_bad">
<codeclass="descname">set_bad</code><spanclass="sig-paren">(</span><em>color='k'</em>, <em>alpha=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Colormap.set_bad" title="Permalink to this definition">¶</a></dt>
<dd><p>Set color to be used for masked values.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.Colormap.set_over">
<codeclass="descname">set_over</code><spanclass="sig-paren">(</span><em>color='k'</em>, <em>alpha=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Colormap.set_over" title="Permalink to this definition">¶</a></dt>
<dd><p>Set color to be used for high out-of-range values.
Requires norm.clip = False</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.Colormap.set_under">
<codeclass="descname">set_under</code><spanclass="sig-paren">(</span><em>color='k'</em>, <em>alpha=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Colormap.set_under" title="Permalink to this definition">¶</a></dt>
<dd><p>Set color to be used for low out-of-range values.
Requires norm.clip = False</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.LightSource">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">LightSource</code><spanclass="sig-paren">(</span><em>azdeg=315</em>, <em>altdeg=45</em>, <em>hsv_min_val=0</em>, <em>hsv_max_val=1</em>, <em>hsv_min_sat=1</em>, <em>hsv_max_sat=0</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LightSource" title="Permalink to this definition">¶</a></dt>
<p>Create a light source coming from the specified azimuth and elevation.
Angles are in degrees, with the azimuth measured
clockwise from north and elevation up from the zero plane of the surface.</p>
<p>The <aclass="reference internal" href="#matplotlib.colors.LightSource.shade" title="matplotlib.colors.LightSource.shade"><codeclass="xref py py-meth docutils literal"><spanclass="pre">shade()</span></code></a> is used to produce “shaded” rgb values for a data array.
<aclass="reference internal" href="#matplotlib.colors.LightSource.shade_rgb" title="matplotlib.colors.LightSource.shade_rgb"><codeclass="xref py py-meth docutils literal"><spanclass="pre">shade_rgb()</span></code></a> can be used to combine an rgb image with
The <aclass="reference internal" href="#matplotlib.colors.LightSource.shade_rgb" title="matplotlib.colors.LightSource.shade_rgb"><codeclass="xref py py-meth docutils literal"><spanclass="pre">shade_rgb()</span></code></a>
The <aclass="reference internal" href="#matplotlib.colors.LightSource.hillshade" title="matplotlib.colors.LightSource.hillshade"><codeclass="xref py py-meth docutils literal"><spanclass="pre">hillshade()</span></code></a> produces an illumination map of a surface.</p>
<p>Specify the azimuth (measured clockwise from south) and altitude
(measured up from the plane of the surface) of the light source
<div><p>The azimuth (0-360, degrees clockwise from North) of the light
source. Defaults to 315 degrees (from the northwest).</p>
</div></blockquote>
<p><strong>altdeg</strong> : number, optional</p>
<blockquoteclass="last">
<div><p>The altitude (0-90, degrees up from horizontal) of the light
source. Defaults to 45 degrees from horizontal.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Notes</p>
<p>For backwards compatibility, the parameters <em>hsv_min_val</em>,
<em>hsv_max_val</em>, <em>hsv_min_sat</em>, and <em>hsv_max_sat</em> may be supplied at
initialization as well. However, these parameters will only be used if
“blend_mode=’hsv’” is passed into <aclass="reference internal" href="#matplotlib.colors.LightSource.shade" title="matplotlib.colors.LightSource.shade"><codeclass="xref py py-meth docutils literal"><spanclass="pre">shade()</span></code></a> or <aclass="reference internal" href="#matplotlib.colors.LightSource.shade_rgb" title="matplotlib.colors.LightSource.shade_rgb"><codeclass="xref py py-meth docutils literal"><spanclass="pre">shade_rgb()</span></code></a>.
See the documentation for <aclass="reference internal" href="#matplotlib.colors.LightSource.blend_hsv" title="matplotlib.colors.LightSource.blend_hsv"><codeclass="xref py py-meth docutils literal"><spanclass="pre">blend_hsv()</span></code></a> for more details.</p>
<dlclass="method">
<dtid="matplotlib.colors.LightSource.blend_hsv">
<codeclass="descname">blend_hsv</code><spanclass="sig-paren">(</span><em>rgb</em>, <em>intensity</em>, <em>hsv_max_sat=None</em>, <em>hsv_max_val=None</em>, <em>hsv_min_val=None</em>, <em>hsv_min_sat=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LightSource.blend_hsv" title="Permalink to this definition">¶</a></dt>
<dd><p>Take the input data array, convert to HSV values in the given colormap,
then adjust those color values to give the impression of a shaded
relief map with a specified light source. RGBA values are returned,
which can then be used to plot the shaded image with imshow.</p>
<p>The color of the resulting image will be darkened by moving the (s,v)
values (in hsv colorspace) toward (hsv_min_sat, hsv_min_val) in the
shaded regions, or lightened by sliding (s,v) toward (hsv_max_sat
hsv_max_val) in regions that are illuminated. The default extremes are
chose so that completely shaded points are nearly black (s = 1, v = 0)
and completely illuminated points are nearly white (s = 0, v = 1).</p>
<codeclass="descname">blend_overlay</code><spanclass="sig-paren">(</span><em>rgb</em>, <em>intensity</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LightSource.blend_overlay" title="Permalink to this definition">¶</a></dt>
<dd><p>Combines an rgb image with an intensity map using “overlay” blending.</p>
<codeclass="descname">blend_soft_light</code><spanclass="sig-paren">(</span><em>rgb</em>, <em>intensity</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LightSource.blend_soft_light" title="Permalink to this definition">¶</a></dt>
<dd><p>Combines an rgb image with an intensity map using “soft light”
blending. Uses the “pegtop” formula.</p>
<div><p>An MxNx3 RGB array representing the combined images.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.LightSource.hillshade">
<codeclass="descname">hillshade</code><spanclass="sig-paren">(</span><em>elevation</em>, <em>vert_exag=1</em>, <em>dx=1</em>, <em>dy=1</em>, <em>fraction=1.0</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LightSource.hillshade" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculates the illumination intensity for a surface using the defined
azimuth and elevation for the light source.</p>
<p>Imagine an artificial sun placed at infinity in some azimuth and
elevation position illuminating our surface. The parts of the surface
that slope toward the sun should brighten while those sides facing away
<div><p>The colormap used to color the <em>data</em> array. Note that this must be
a <aclass="reference internal" href="#matplotlib.colors.Colormap" title="matplotlib.colors.Colormap"><codeclass="xref py py-obj docutils literal"><spanclass="pre">Colormap</span></code></a> instance. For example, rather than
passing in <codeclass="xref py py-obj docutils literal"><spanclass="pre">cmap='gist_earth'</span></code>, use
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">LinearSegmentedColormap</code><spanclass="sig-paren">(</span><em>name</em>, <em>segmentdata</em>, <em>N=256</em>, <em>gamma=1.0</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LinearSegmentedColormap" title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="descname">from_list</code><spanclass="sig-paren">(</span><em>name</em>, <em>colors</em>, <em>N=256</em>, <em>gamma=1.0</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LinearSegmentedColormap.from_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a linear segmented colormap with <em>name</em> from a sequence
of <em>colors</em> which evenly transitions from colors[0] at val=0
to colors[-1] at val=1. <em>N</em> is the number of rgb quantization
levels.
Alternatively, a list of (value, color) tuples can be given
<codeclass="descname">set_gamma</code><spanclass="sig-paren">(</span><em>gamma</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LinearSegmentedColormap.set_gamma" title="Permalink to this definition">¶</a></dt>
<dd><p>Set a new gamma value and regenerate color map.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.ListedColormap">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">ListedColormap</code><spanclass="sig-paren">(</span><em>colors</em>, <em>name='from_list'</em>, <em>N=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.ListedColormap" title="Permalink to this definition">¶</a></dt>
<pclass="last">the list will be extended by repetition.</p>
</dd>
</dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.LogNorm">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">LogNorm</code><spanclass="sig-paren">(</span><em>vmin=None</em>, <em>vmax=None</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LogNorm" title="Permalink to this definition">¶</a></dt>
<p>Works with scalars or arrays, including masked arrays. If
<em>clip</em> is <em>True</em>, masked values are set to 1; otherwise they
remain masked. Clipping silently defeats the purpose of setting
the over, under, and masked colors in the colormap, so it is
likely to lead to surprises; therefore the default is
<em>clip</em> = <em>False</em>.</p>
<dlclass="method">
<dtid="matplotlib.colors.LogNorm.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LogNorm.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set <em>vmin</em>, <em>vmax</em> to min, max of <em>A</em>.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.LogNorm.autoscale_None">
<codeclass="descname">autoscale_None</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LogNorm.autoscale_None" title="Permalink to this definition">¶</a></dt>
<dd><p>autoscale only None-valued vmin or vmax</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.LogNorm.inverse">
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.LogNorm.inverse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.NoNorm">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">NoNorm</code><spanclass="sig-paren">(</span><em>vmin=None</em>, <em>vmax=None</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.NoNorm" title="Permalink to this definition">¶</a></dt>
<p>Works with scalars or arrays, including masked arrays. If
<em>clip</em> is <em>True</em>, masked values are set to 1; otherwise they
remain masked. Clipping silently defeats the purpose of setting
the over, under, and masked colors in the colormap, so it is
likely to lead to surprises; therefore the default is
<em>clip</em> = <em>False</em>.</p>
<dlclass="method">
<dtid="matplotlib.colors.NoNorm.inverse">
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.NoNorm.inverse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.Normalize">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">Normalize</code><spanclass="sig-paren">(</span><em>vmin=None</em>, <em>vmax=None</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize" title="Permalink to this definition">¶</a></dt>
<p>Works with scalars or arrays, including masked arrays. If
<em>clip</em> is <em>True</em>, masked values are set to 1; otherwise they
remain masked. Clipping silently defeats the purpose of setting
the over, under, and masked colors in the colormap, so it is
likely to lead to surprises; therefore the default is
<em>clip</em> = <em>False</em>.</p>
<dlclass="method">
<dtid="matplotlib.colors.Normalize.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set <em>vmin</em>, <em>vmax</em> to min, max of <em>A</em>.</p>
<codeclass="descname">autoscale_None</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize.autoscale_None" title="Permalink to this definition">¶</a></dt>
<dd><p>autoscale only None-valued vmin or vmax</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.Normalize.inverse">
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize.inverse" title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="descname">process_value</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize.process_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Homogenize the input <em>value</em> for easy and efficient normalization.</p>
<p><em>value</em> can be a scalar or sequence.</p>
<p>Returns <em>result</em>, <em>is_scalar</em>, where <em>result</em> is a
masked array matching <em>value</em>. Float dtypes are preserved;
integer types with two bytes or smaller are converted to
np.float32, and larger types are converted to np.float.
Preserving float32 when possible, and using in-place operations,
can greatly improve speed for large arrays.</p>
<p>Experimental; we may want to add an option to force the
use of float32.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.Normalize.scaled">
<codeclass="descname">scaled</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.Normalize.scaled" title="Permalink to this definition">¶</a></dt>
<dd><p>return true if vmin and vmax set</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.PowerNorm">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">PowerNorm</code><spanclass="sig-paren">(</span><em>gamma</em>, <em>vmin=None</em>, <em>vmax=None</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.PowerNorm" title="Permalink to this definition">¶</a></dt>
<p>Normalize a given value to the <codeclass="docutils literal"><spanclass="pre">[0,</span><spanclass="pre">1]</span></code> interval with a power-law
scaling. This will clip any negative data points to 0.</p>
<dlclass="method">
<dtid="matplotlib.colors.PowerNorm.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.PowerNorm.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set <em>vmin</em>, <em>vmax</em> to min, max of <em>A</em>.</p>
<codeclass="descname">autoscale_None</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.PowerNorm.autoscale_None" title="Permalink to this definition">¶</a></dt>
<dd><p>autoscale only None-valued vmin or vmax</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.PowerNorm.inverse">
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.PowerNorm.inverse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.colors.SymLogNorm">
<emclass="property">class </em><codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">SymLogNorm</code><spanclass="sig-paren">(</span><em>linthresh</em>, <em>linscale=1.0</em>, <em>vmin=None</em>, <em>vmax=None</em>, <em>clip=False</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.SymLogNorm" title="Permalink to this definition">¶</a></dt>
<p>The symmetrical logarithmic scale is logarithmic in both the
positive and negative directions from the origin.</p>
<p>Since the values close to zero tend toward infinity, there is a
need to have a range around zero that is linear. The parameter
<em>linthresh</em> allows the user to specify the size of this range
(-<em>linthresh</em>, <em>linthresh</em>).</p>
<p><em>linthresh</em>:
The range within which the plot is linear (to
avoid having the plot go to infinity around zero).</p>
<p><em>linscale</em>:
This allows the linear range (-<em>linthresh</em> to <em>linthresh</em>)
to be stretched relative to the logarithmic range. Its
value is the number of decades to use for each half of the
linear range. For example, when <em>linscale</em> == 1.0 (the
default), the space used for the positive and negative
halves of the linear range will be equal to one decade in
the logarithmic range. Defaults to 1.</p>
<dlclass="method">
<dtid="matplotlib.colors.SymLogNorm.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.SymLogNorm.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set <em>vmin</em>, <em>vmax</em> to min, max of <em>A</em>.</p>
<codeclass="descname">autoscale_None</code><spanclass="sig-paren">(</span><em>A</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.SymLogNorm.autoscale_None" title="Permalink to this definition">¶</a></dt>
<dd><p>autoscale only None-valued vmin or vmax</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.colors.SymLogNorm.inverse">
<codeclass="descname">inverse</code><spanclass="sig-paren">(</span><em>value</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.SymLogNorm.inverse" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.colors.from_levels_and_colors">
<codeclass="descclassname">matplotlib.colors.</code><codeclass="descname">from_levels_and_colors</code><spanclass="sig-paren">(</span><em>levels</em>, <em>colors</em>, <em>extend='neither'</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.colors.from_levels_and_colors" title="Permalink to this definition">¶</a></dt>
<dd><p>A helper routine to generate a cmap and a norm instance which
behave similar to contourf’s levels and colors arguments.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><pclass="first"><strong>levels</strong> : sequence of numbers</p>
<blockquote>
<div><p>The quantization levels used to construct the <aclass="reference internal" href="#matplotlib.colors.BoundaryNorm" title="matplotlib.colors.BoundaryNorm"><codeclass="xref py py-class docutils literal"><spanclass="pre">BoundaryNorm</span></code></a>.
Values <codeclass="docutils literal"><spanclass="pre">v</span></code> are quantizized to level <codeclass="docutils literal"><spanclass="pre">i</span></code> if
<p><strong>colors</strong> : sequence of colors</p>
<blockquote>
<div><p>The fill color to use for each level. If <codeclass="xref py py-obj docutils literal"><spanclass="pre">extend</span></code> is “neither” there
must be <codeclass="docutils literal"><spanclass="pre">n_level</span><spanclass="pre">-</span><spanclass="pre">1</span></code> colors. For an <codeclass="xref py py-obj docutils literal"><spanclass="pre">extend</span></code> of “min” or “max” add
one extra color, and for an <codeclass="xref py py-obj docutils literal"><spanclass="pre">extend</span></code> of “both” add two colors.</p>