🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions doc/users/plotting/colormaps/lightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down Expand Up @@ -46,16 +47,16 @@
# 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
# to make scatter markers change color along plot:
# 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])
Expand All @@ -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])
Expand Down