matplotlib/cmocean

cmocean requires skimage

OceanWolf opened this issue · 9 comments

Loving the work here, and looking forward to trying it out when I get my hands on some Temperature data tomorrow (and looking forward to the speed colourmaps).

Just one thing, why the dependency on skimage? What do the imports in __init__.py accomplish?

Traceback (most recent call last):
  File "process.py", line 2, in <module>
    import cmocean
  File "/home/jack/Projects/matplotlib/cmocean/cmocean/__init__.py", line 11, in <module>
    import plots
  File "/home/jack/Projects/matplotlib/cmocean/cmocean/plots.py", line 9, in <module>
    from skimage import color
ImportError: No module named skimage

I'm not great at packaging, but as I understand it, the imports in cmocean/init.py let you do the following:
import cmocean
cmocean.plots.wrap_viscm(cmocean.cm.o2)
so you can easily use the functions in the package.

I had been taking out the dependency on skimage, which was being used for converting between RGB and CIELAB colorspace in the plotting functions. I just pushed an update through which removes skimage as a dependency because I wanted to use the cam02ucs colorspace from colorspacious, another package. I've only imported colorspacious in the plotting routines in which it is actually used in case you don't want to use it.

Yes, all the stuff in __init__.py lets you do:

import cmocean
cmap = cmocean.cm.turb

With an empty __init__.py you have to do something like:

import cmocean.cm as cmaps
cmap = cmaps.turb

Just updated and now it work great, thanks! Also noticed that the freesurface colour map does not appear on the main page, but another issue ;).

Oops, I forgot to update the docs branch, but it should be good now.

On Wed, Sep 2, 2015 at 7:58 PM, OceanWolf notifications@github.com wrote:

Yes, all the stuff in init.py lets you do:

import cmocean
cmap = cmocean.cm.turb

With an empty init.py you have to do something like:

import cmocean.cm as cmaps
cmap = cmaps.turb

Just updated and now it work great, thanks! Also noticed that the
freesurface colour map does not appear on the main page, but another issue
;).


Reply to this email directly or view it on GitHub
#15 (comment).

Kristen M. Thyng
Assistant Research Scientist
Department of Oceanography
Texas A&M University
Eller O&M 618
http://kristenthyng.com

Lol, good to see the option-d removed, but you still have it in the code, albeit commented out, you know git stores all that information, right?

Problems still remaining in the doc...

  • 2nd image has odd stuff going on (spacing and cutoff)
  • 3rd image has a Toggle gamut button in the image...

Also I think it would help to mention the aliases unless you intend to change them later, e.g. different colourmaps for freesurface, seasurface, eta and zeta, Also perhaps explain the acronyms somewhere (I have never encountered PAR or CDOM before, though I presume they stand for Photosynthetically Active Radiation and Coloured Dissolved Organic Matter, when I first read it I thought PARticulate matter), and at the end you have "Indices and Tables", but have no tables...

Also do you have savefig.bbox : tight set? I find it great for generating figures for publication as it allows LaTeX and HTML to get a consistent looking width when setting width to a fixed size, i.e. 100% of the page/screen width.

Yes, option-d is still in there... is it in matplotlib yet? It was handy to
have it available.

The spacing is weird in the lightness plot (2nd) because of the diverging
parts of colormaps and it is hard to avoid that way I've set up the plot. I
figured it got the point across anyway. Please fix it if you are inspired!

The Toggle gamut button is from viscm and just gets saved in there when the
figure is saved.

The aliases for colormaps are all available using cmocean.cm.cmnames.

That's fair about the names — I've added a long_name attribute to each
colormap which contains what the acronym stands for if there is an acronym.
I'll push it to the matplotlib version a little later today.

There are some quirks in the documentation because I'm still learning how
gh-pages works. Again, you are welcome to fix these; that would be great!

In plots.py there is a "bbox_inches='tight'" in every savefig command.

On Wed, Sep 2, 2015 at 9:27 PM, OceanWolf notifications@github.com wrote:

Also do you have savefig.bbox : tight set? I find it great for generating
figures for publication as it allows LaTeX and HTML to get a consistent
looking width when setting width to a fixed size, i.e. 100% of the
page/screen width.


Reply to this email directly or view it on GitHub
#15 (comment).

Kristen M. Thyng
Assistant Research Scientist
Department of Oceanography
Texas A&M University
Eller O&M 608
http://kristenthyng.com

Hmm, I see it commented out in https://github.com/matplotlib/cmocean/blob/master/cmocean/cm.py

The new colour maps have entered master, and as far as I know will go out in the upcoming 1.5 release, option-d has now been renamed viridis on master and in version 2.0 will replace the unspeakable colour-map as the default colour-map, named after Morelia viridis for obvious reasons, see wikipedia ;).

As and when I find time I will no doubt fix it... but who knows when that will occur 🎐

Can I close this issue?

'module' object has no attribute 'plots'