diff --git a/.travis.yml b/.travis.yml index b749e95781ac..a12e6b4d4078 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,7 +78,7 @@ install: - | if [[ $BUILD_DOCS == true ]]; then - pip install $PRE numpydoc ipython + pip install $PRE numpydoc ipython colorspacious pip install -q $PRE linkchecker wget https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O Felipa-Regular.ttf wget http://mirrors.kernel.org/ubuntu/pool/universe/f/fonts-humor-sans/fonts-humor-sans_1.0-1_all.deb diff --git a/doc/users/plotting/colormaps/lightness.py b/doc/users/plotting/colormaps/lightness.py index acf4c92728e0..50cb4728e7f1 100644 --- a/doc/users/plotting/colormaps/lightness.py +++ b/doc/users/plotting/colormaps/lightness.py @@ -14,6 +14,7 @@ import matplotlib.pyplot as plt from matplotlib import cm import matplotlib as mpl +from colorspacious import cspace_converter mpl.rcParams.update({'font.size': 12}) @@ -46,8 +47,8 @@ # Get rgb values for colormap rgb = cm.get_cmap(cmap)(x)[np.newaxis,:,:3] - # Get colormap in CIE LAB. We want the L here. - lab = color.rgb2lab(rgb) + # Get colormap in CAM02-UCS colorspace. We want the lightness. + lab = cspace_converter("sRGB1", "CAM02-UCS")(rgb) # Plot colormap L values # Do separately for each category so each plot can be pretty @@ -55,7 +56,7 @@ # http://stackoverflow.com/questions/8202605/matplotlib-scatterplot-colour-as-a-function-of-a-third-variable if cmap_category=='Perceptually Uniform Sequential': dc = 1.15 # spacing between colormaps - ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap, + ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) if i==2: ax.axis([-0.1,4.1,0,100]) @@ -65,7 +66,9 @@ elif cmap_category=='Sequential': dc = 0.6 # spacing between colormaps - ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap + '_r', + # These colormaps all start at high lightness but we want them + # reversed to look nice in the plot, so reverse the order. + ax.scatter(x+j*dc, lab[0,::-1,0], c=x[::-1], cmap=cmap, s=300, linewidths=0.) if i==2: ax.axis([-0.1,4.1,0,100])