title: Plotting dictionary of colors in Python
body: <p>I'm trying to display a dictionary of custom colors in Python using the example in the <a href="https://matplotlib.org/stable/users/dflt_style_changes.html#colors-in-default-property-cycle" rel="nofollow noreferrer">matplotlib docs</a></p>
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  th = np.linspace(0, 2*np.pi, 512)
  
  fig, ax1 = plt.subplots(1, 1, figsize=(6, 3))
  
  
  def color_demo(ax, colors, title):
      ax.set_title(title)
      for j, c in enumerate(colors):
          v_offset = -(j / len(colors))
          ax.plot(th, .1*np.sin(th) + v_offset, color=c)
          ax.annotate(&quot;'C{}'&quot;.format(j), (0, v_offset),
                      xytext=(-1.5, 0),
                      ha='right',
                      va='center',
                      color=c,
                      textcoords='offset points',
                      family='monospace')
  
          ax.annotate(&quot;{!r}&quot;.format(c), (2*np.pi, v_offset),
                      xytext=(1.5, 0),
                      ha='left',
                      va='center',
                      color=c,
                      textcoords='offset points',
                      family='monospace')
      ax.axis('off')
  
  mycolors = {
      'br': ((84/255), (0/255), (0/255)),
      'bl': ((15/255), (123/255), (175/255)),
      'yl': ((255/255), (186/255), (45/255)),
      'rd': ((237/255), (23/255), (69/255)),
      'gy': ((210/255), (210/255), (210/255))
      }
  
  color_demo(ax1, mycolors, 'mycolors')
  
  fig.subplots_adjust(**{'bottom': 0.0, 'left': 0.059,
                         'right': 0.869, 'top': 0.895})
  </code></pre>
  <p>But I get the error <code>ValueError: 'br1' is not a valid value for color</code>.</p>