<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 03/08/2018 à 22:43, Matthew Bradley
      a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPXQNQWJPNyU46cCwoA+qRAavUq0qvS2TbLO=81gpopvMt_ncw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small">All:</div>
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small"><br>
        </div>
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small">I have a
          raster that I want to add a colorbar to, and I've tried
          playing around with a few things, both giving the axes image a
          name and then calling it in the colorbar function i.e:</div>
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small"><br>
        </div>
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small">
          <div class="gmail_default">cax =
            axes.imshow(raster_contrast*sorted_raster,
            aspect=aspect_ratio)</div>
          <div class="gmail_default">cbar = fig.colorbar(cax,
            orientation='horizontal')</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">and after the image is plotted like
            so:</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">
            <div class="gmail_default">
              <div class="gmail_default">cax = ax[1].get_images()[0]</div>
              <div class="gmail_default">cbar = fig.colorbar(cax,
                orientation='horizontal', cax=ax[2])</div>
              <div class="gmail_default"><br>
              </div>
              <div class="gmail_default">In either case it produces a
                PCyGY colormap</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Viridis[0]?<br>
    <br>
    <blockquote type="cite"
cite="mid:CAPXQNQWJPNyU46cCwoA+qRAavUq0qvS2TbLO=81gpopvMt_ncw@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:tahoma,sans-serif;font-size:small">
          <div class="gmail_default">
            <div class="gmail_default">
              <div class="gmail_default"> instead of the diverging
                RGBlack color scheme. How can I replicate the correct
                color map in the color bar? Both of these methods appear
                to work for 2-D array. </div>
              <div class="gmail_default"><br>
              </div>
              <div class="gmail_default">the sorted raster is an array
                of shape [861, 138, 3].</div>
              <div class="gmail_default"><br>
              </div>
              <div class="gmail_default">Thanks in advance for any help!</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I don’t really know how to get a colorbar for RGB(A) arrays, but you
    need to add something I guess. You’re currently getting the default
    colormap and associated colorbar.<br>
    <p>[0]:
      <a class="moz-txt-link-freetext" href="https://matplotlib.org/2.0.0/users/plotting/colormaps/lightness_00.png">https://matplotlib.org/2.0.0/users/plotting/colormaps/lightness_00.png</a><br>
    </p>
  </body>
</html>