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
<spanid="sphx-glr-tutorials-colors-colors-py"></span><h1>Specifying Colors<aclass="headerlink" href="#specifying-colors" title="Permalink to this heading">#</a></h1>
<p>Matplotlib recognizes the following formats to specify a color.</p>
<trclass="row-even"><td><p>Case-insensitive color name from
<aclass="reference external" href="https://xkcd.com/color/rgb/">xkcd color survey</a> with <codeclass="docutils literal notranslate"><spanclass="pre">'xkcd:'</span></code>
<li><imgsrc="../../_images/sphx_glr_colors_001.png" srcset="../../_images/sphx_glr_colors_001.png, ../../_images/sphx_glr_colors_001_2_0x.png 2.0x" alt="style: 'default'" class = "sphx-glr-multi-img"/></li>
<li><imgsrc="../../_images/sphx_glr_colors_002.png" srcset="../../_images/sphx_glr_colors_002.png, ../../_images/sphx_glr_colors_002_2_0x.png 2.0x" alt="style: 'seaborn-v0_8'" class = "sphx-glr-multi-img"/></li>
</ul>
<p>The first color <codeclass="docutils literal notranslate"><spanclass="pre">'C0'</span></code> is the title. Each plot uses the second and third
colors of each style's <codeclass="docutils literal notranslate"><aclass="reference internal" href="../introductory/customizing.html?highlight=axes.prop_cycle#matplotlibrc-sample"><spanclass="std std-ref"><spanclass="pre">rcParams["axes.prop_cycle"]</span></span></a></code> (default: <codeclass="docutils literal notranslate"><spanclass="pre">cycler('color',</span><spanclass="pre">['#1f77b4',</span><spanclass="pre">'#ff7f0e',</span><spanclass="pre">'#2ca02c',</span><spanclass="pre">'#d62728',</span><spanclass="pre">'#9467bd',</span><spanclass="pre">'#8c564b',</span><spanclass="pre">'#e377c2',</span><spanclass="pre">'#7f7f7f',</span><spanclass="pre">'#bcbd22',</span><spanclass="pre">'#17becf'])</span></code>). They are <codeclass="docutils literal notranslate"><spanclass="pre">'C1'</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">'C2'</span></code>,
<spanid="xkcd-colors"></span><h2>Comparison between X11/CSS4 and xkcd colors<aclass="headerlink" href="#comparison-between-x11-css4-and-xkcd-colors" title="Permalink to this heading">#</a></h2>
<p>The xkcd colors come from a <aclass="reference external" href="https://blog.xkcd.com/2010/05/03/color-survey-results/">user survey conducted by the webcomic xkcd</a>.</p>
<p>95 out of the 148 X11/CSS4 color names also appear in the xkcd color survey.
Almost all of them map to different color values in the X11/CSS4 and in
the xkcd palette. Only 'black', 'white' and 'cyan' are identical.</p>
<p>For example, <codeclass="docutils literal notranslate"><spanclass="pre">'blue'</span></code> maps to <codeclass="docutils literal notranslate"><spanclass="pre">'#0000FF'</span></code> whereas <codeclass="docutils literal notranslate"><spanclass="pre">'xkcd:blue'</span></code> maps to
<codeclass="docutils literal notranslate"><spanclass="pre">'#0343DF'</span></code>. Due to these name collisions, all xkcd colors have the
<imgsrc="../../_images/sphx_glr_colors_003.png" srcset="../../_images/sphx_glr_colors_003.png, ../../_images/sphx_glr_colors_003_2_0x.png 2.0x" alt="colors" class = "sphx-glr-single-img"/><pclass="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 1.452 seconds)</p>