title: reverse a custom colormap
body: <p>I want to reverse my custom colormap which looks like this</p>
  
  <pre><code>import matplotlib.cm as cm
  import matplotlib as mpl
  
  cm.register_cmap(name='owb',
      data = {'red':      ((0.0, 1.0, 1.0),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 0.0, 0.0)), # blue
  
              'green':    ((0.0, 0.6, 0.6),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 0.0, 0.0)), # blue
  
               'blue':    ((0.0, 0.0, 0.0),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 1.0, 1.0))  # blue
              })
  </code></pre>
  
  <p>Now since I am searching for a solution to this for quite some time and while doing so I came across this thread:</p>
  
  <p><a href="https://stackoverflow.com/questions/3279560/reverse-colormap-in-matplotlib">colormap reversed</a></p>
  
  <p>I tried to use <code>.reversed()</code> here:</p>
  
  <pre><code>data = {'red':      ((0.0, 1.0, 1.0),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 0.0, 0.0)), # blue
  
              'green':    ((0.0, 0.6, 0.6),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 0.0, 0.0)), # blue
  
               'blue':    ((0.0, 0.0, 0.0),  # orange
                          (0.5, 1.0, 1.0),  #
                          (1.0, 1.0, 1.0))  # blue
              }
  owb = mpl.colors.ListedColormap('OrWhBlu', data)
  owb_reversed = owb.reversed()
  </code></pre>
  
  <p>Here I got the following Error:</p>
  
  <p><code>TypeError: unsupported operand type(s) for +: 'dict' and 'str'</code></p>
  
  <p>but I just didn't manage to make it work.</p>
  
  <p>Please let me know what I am doing wrong.<br>
  Cheers</p>
  
  <p>EDIT:
  I tried the solution of Kostas, and since i have to use the colormap_r in another function where the name of the cmap is required I tried to solve it this way:</p>
  
  <pre><code>cmap_r = cm.register_cmap(name="owb_r", cmap=owb_r)
  </code></pre>
  
  <p>the function where it is called:</p>
  
  <pre><code>plt.pcolormesh(xx, yy, -Z, cmap="owb_r")
  plt.scatter(X_2d[:, 0], X_2d[:, 1], c=y_2d, cmap="owb_r",
              edgecolors='k')
  </code></pre>
  
  <p>now i get following Error:
  <code>ValueError: Invalid RGBA argument: 'u'</code></p>