[Matplotlib-users] Displaying raster colormap in a colorbar

Benjamin Root ben.v.root at gmail.com
Fri Aug 3 17:09:58 EDT 2018


I think the issue is that the user is passing in an RGB array, but wants a
colormap that matches that array. That is a bit tricky. Do I have my
understanding correct?

Ben

On Fri, Aug 3, 2018 at 4:49 PM, Matthew Bradley <mbatr27 at gmail.com> wrote:

> I'll work on it, thanks for the prompt response!
>
> On Fri, Aug 3, 2018 at 2:46 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> Sorry I don’t quite understand this question.
>>
>> Is there any chance you can make a concrete minimal, runnavle example
>> using fake data that delonstrates the issue?
>>
>> On Fri, Aug 3, 2018 at 3:44 PM Matthew Bradley <mbatr27 at gmail.com> wrote:
>>
>>> All:
>>>
>>> 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:
>>>
>>> cax = axes.imshow(raster_contrast*sorted_raster, aspect=aspect_ratio)
>>> cbar = fig.colorbar(cax, orientation='horizontal')
>>>
>>> and after the image is plotted like so:
>>>
>>> cax = ax[1].get_images()[0]
>>> cbar = fig.colorbar(cax, orientation='horizontal', cax=ax[2])
>>>
>>> In either case it produces a PCyGY colormap 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.
>>>
>>> the sorted raster is an array of shape [861, 138, 3].
>>>
>>> Thanks in advance for any help!
>>> --
>>> Matthew Bradley
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>>
>>
>
>
> --
> Matthew Bradley
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180803/4595ea07/attachment-0001.html>


More information about the Matplotlib-users mailing list