[GRASS-dev] r.colors.matplotlib

Vaclav Petras wenzeslaus at gmail.com
Thu Jun 1 19:51:05 PDT 2017


Hi Steve,

On Tue, May 30, 2017 at 3:10 PM, Steven Pawley <dr.stevenpawley at gmail.com>
wrote:

>
> Thanks for writing the r.colors.matplotlib tools because I use the
> matplotlib colorramps very frequently both in GRASS and in python more
> generally.
>

Glad to hear that.


>
> I seem to be having a problem of using the perceptually uniform ramps in
> the r.colors.matplotlib add on, receiving the error: ERROR: Matplotlib
> 2.0.2 does not contain color table <plasma>
>
> I'm on linux and matplotlib 2.0.2 has the perceptually uniform ramps, and
> I can use them if I display data in python within a GRASS session directly
> (i.e. plt.imshow(numpyraster, cmap='plasma').
>
> Is there a reason why r.colors.matplotlib can't see these ramps? It still
> works with all of the traditional matplotlib ramps.


The module does not check for specific color maps in mpl, but it uses
general code to check the presence of a requested color map. It imports
matplotlib.cm.datad dictionary. Perhaps, this dictionary does not contain
the new color maps. The checking is not ideal, it should based on
cm.get_map() function. I think the reason why I "ask for permission" here
instead is that I was not able to figure out what is the error state from
get_map() or how to transfer it to the user. But perhaps you will be more
successful or 2.0 behaves differently. The relevant code is here:

https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.colors.matplotlib/r.colors.matplotlib.py#L164

Best,
Vaclav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20170601/f93b026f/attachment.html>


More information about the grass-dev mailing list