From 8aec046f6972beae84c46f59dbfbf06edb2884ca Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 19 Aug 2015 20:43:06 +0100 Subject: [PATCH 01/10] Add new colormaps to colormaps_reference --- examples/color/colormaps_reference.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/color/colormaps_reference.py b/examples/color/colormaps_reference.py index ebd66ef00f3c..00abb22f634a 100644 --- a/examples/color/colormaps_reference.py +++ b/examples/color/colormaps_reference.py @@ -41,8 +41,9 @@ 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'pink', - 'spring', 'summer', 'winter']), + 'gist_heat', 'gray', 'hot', 'inferno', 'magma', + 'pink', 'plasma', 'spring', 'summer', 'viridis', + 'winter']), ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'seismic']), From 4bc613f447653ec816f8154fbdffad27d610f46d Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 19 Aug 2015 21:45:13 +0100 Subject: [PATCH 02/10] Add new colormaps to lightness Also partly pep8 and make the figure a bit smaller --- doc/users/plotting/colormaps/lightness.py | 57 ++++++++++++++--------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/doc/users/plotting/colormaps/lightness.py b/doc/users/plotting/colormaps/lightness.py index 2fe0721b688a..e094fb58e13a 100644 --- a/doc/users/plotting/colormaps/lightness.py +++ b/doc/users/plotting/colormaps/lightness.py @@ -6,15 +6,17 @@ import colorconv as color #from skimage import color -# we are using a local copy of colorconv from scikit-image to reduce dependencies. +# we are using a local copy of colorconv from scikit-image to +# reduce dependencies. # You should probably use the one from scikit-image in most cases. import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import matplotlib as mpl -mpl.rcParams.update({'font.size': 14}) -mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif' +mpl.rcParams.update({'font.size': 12}) +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' +'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans' @@ -24,15 +26,17 @@ mpl.rcParams['mathtext.sf'] = 'sans' mpl.rcParams['mathtext.fallback_to_cm'] = 'True' -# Have colormaps separated into categories: http://matplotlib.org/examples/color/colormaps_reference.html +# Have colormaps separated into categories: +# http://matplotlib.org/examples/color/colormaps_reference.html cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'pink', - 'spring', 'summer', 'winter']), + 'gist_heat', 'gray', 'hot', 'inferno', 'magma', + 'pink', 'plasma', 'spring', 'summer', 'viridis', + 'winter']), ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'seismic']), @@ -60,14 +64,13 @@ dsub = 7 nsubplots = int(np.ceil(len(cmap_list)/float(dsub))) - fig = plt.figure(figsize=(11.5,4*nsubplots)) + fig = plt.figure(figsize=(7,2.6*nsubplots)) for i, subplot in enumerate(range(nsubplots)): locs = [] # locations for text labels ax = fig.add_subplot(nsubplots, 1, i+1) - # pdb.set_trace() for j, cmap in enumerate(cmap_list[i*dsub:(i+1)*dsub]): @@ -79,10 +82,12 @@ # 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 + # 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=='Sequential': dc = 0.6 # spacing between colormaps - ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap + '_r', s=300, linewidths=0.) + ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap + '_r', + s=300, linewidths=0.) if i==2: ax.axis([-0.1,4.1,0,100]) else: @@ -91,27 +96,34 @@ elif cmap_category=='Sequential (2)': dc = 1.15 - ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) + ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, + s=300, linewidths=0.) ax.axis([-0.1,7.0,0,100]) - locs.append(x[-1]+j*dc) # store locations for colormap labels + # store locations for colormap labels + locs.append(x[-1]+j*dc) elif cmap_category=='Diverging': dc = 1.2 - ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) + ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, + s=300, linewidths=0.) ax.axis([-0.1,7.1,0,100]) - locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels - + # store locations for colormap labels + locs.append(x[int(x.size/2.)]+j*dc) elif cmap_category=='Qualitative': dc = 1.3 - ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) + ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, + s=300, linewidths=0.) ax.axis([-0.1,6.3,0,100]) - locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels + # store locations for colormap labels + locs.append(x[int(x.size/2.)]+j*dc) elif cmap_category=='Miscellaneous': dc = 1.25 - ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) + ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, + s=300, linewidths=0.) ax.axis([-0.1,6.1,0,100]) - locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels + # store locations for colormap labels + locs.append(x[int(x.size/2.)]+j*dc) # Set up labels for colormaps ax.xaxis.set_ticks_position('top') @@ -123,8 +135,9 @@ for label in labels: label.set_rotation(60) - ax.set_xlabel(cmap_category + ' colormaps', fontsize=22) - fig.text(-0.005, 0.55, 'Lightness $L^*$', fontsize=18, transform=fig.transFigure, rotation=90) + ax.set_xlabel(cmap_category + ' colormaps', fontsize=14) + fig.text(0.0, 0.55, 'Lightness $L^*$', fontsize=12, + transform=fig.transFigure, rotation=90) - fig.tight_layout(h_pad=0.05) + fig.tight_layout(h_pad=0.05, pad=1.5) plt.show() From cda8be5537f9149110280ee2a3b672f185545158 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 19 Aug 2015 21:46:34 +0100 Subject: [PATCH 03/10] Lfunction tweak size and pep8 --- doc/users/plotting/colormaps/Lfunction.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/users/plotting/colormaps/Lfunction.py b/doc/users/plotting/colormaps/Lfunction.py index c94a8be4b45a..1e0777c93034 100644 --- a/doc/users/plotting/colormaps/Lfunction.py +++ b/doc/users/plotting/colormaps/Lfunction.py @@ -3,7 +3,6 @@ with the binary matplotlib colormap, too. Trying to show the difference between adding blackness to a color at different rates. ''' -from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import colorconv as color @@ -14,8 +13,9 @@ from matplotlib import cm -mpl.rcParams.update({'font.size': 20}) -mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif' +mpl.rcParams.update({'font.size': 12}) +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' +'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans' @@ -42,7 +42,6 @@ for i in range(red.shape[1]): # more blackness is closer to 0 than one, and in first column of LAB lab_add[0,i,0] = lab_add[0,i,0] - 10*i - print(i,k) if i != 0: lab_geometric[0,i,0] = lab_geometric[0,i,0] - 10*k k *= 2 @@ -55,17 +54,15 @@ temp = color.lab2rgb(lab_geometric) rgb_geometric[0,:,0] = temp[0,:,0] -fig = plt.figure() +fig = plt.figure(figsize=(5,3)) k = 1 for i in range(red.shape[1]): # LHS: additive ax1 = fig.add_subplot(nrows,2,i*2+1, axisbg=tuple(rgb_add[0,i,:])) - print(tuple(lab_add[0,i,:]))#, tuple(rgb_add[0,i,:]) # RHS: multiplicative ax2 = fig.add_subplot(nrows,2,i*2+2, axisbg=tuple(rgb_geometric[0,i,:])) - print(tuple(lab_geometric[0,i,:]))#, tuple(rgb_geometric[0,i,:]) # ylabels if i!=0: @@ -122,17 +119,15 @@ rgb_add[:,i,:] = rgb[:,i*di+I0,:] if i != 0: - print(i*di+I0, di*k+I0, (I0**(1./3)+i*di**(1./3))**3) rgb_geometric[:,i,:] = rgb[:,I0+di*k,:] k *= 2 elif i==0: - print(i*di+I0, I0, (I0**(1./3)+i*di**(1./3))**3) rgb_geometric[:,i,:] = rgb[:,I0,:] lab_add = color.rgb2lab(rgb_add) lab_geometric = color.rgb2lab(rgb_geometric) -fig = plt.figure() +fig = plt.figure(figsize=(5,3)) k = 1 for i in range(nrows): @@ -165,7 +160,7 @@ ax2.spines['left'].set_visible(False) # common ylabel -ax1.text(-0.3, 4.0, 'Steps through map indices', +ax1.text(-0.3, 4.5, 'Steps through map indices', rotation=90, transform=ax1.transAxes) fig.subplots_adjust(hspace=0.0) From b6565eac721bcc47044b91a61c616124ad82b556 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 19 Aug 2015 21:47:39 +0100 Subject: [PATCH 04/10] Add colormaps to grayscale Pep8 and tweak size --- doc/users/plotting/colormaps/grayscale.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/users/plotting/colormaps/grayscale.py b/doc/users/plotting/colormaps/grayscale.py index 44bcef224094..48a07539e598 100644 --- a/doc/users/plotting/colormaps/grayscale.py +++ b/doc/users/plotting/colormaps/grayscale.py @@ -13,7 +13,8 @@ import matplotlib as mpl mpl.rcParams.update({'font.size': 14}) -mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif' +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' +'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans' @@ -23,15 +24,17 @@ mpl.rcParams['mathtext.sf'] = 'sans' mpl.rcParams['mathtext.fallback_to_cm'] = 'True' -# Have colormaps separated into categories: http://matplotlib.org/examples/color/colormaps_reference.html +# Have colormaps separated into categories: +# http://matplotlib.org/examples/color/colormaps_reference.html cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'pink', - 'spring', 'summer', 'winter']), + 'gist_heat', 'gray', 'hot', 'inferno', 'magma', + 'pink', 'plasma', 'spring', 'summer', 'viridis', + 'winter']), ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'seismic']), @@ -46,13 +49,15 @@ # indices to step through colormap x = np.linspace(0.0, 1.0, 100) -nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) +# nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) gradient = np.linspace(0, 1, 256) gradient = np.vstack((gradient, gradient)) def plot_color_gradients(cmap_category, cmap_list): + nrows = len(cmap_list) fig, axes = plt.subplots(nrows=nrows, ncols=2) - fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99, wspace=0.05) + fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99, + wspace=0.05) fig.suptitle(cmap_category + ' colormaps', fontsize=14, y=1.0, x=0.6) for ax, name in zip(axes, cmap_list): From 38b891146a7e1eb29976bbd4a6821cc1d5c54fc1 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Wed, 19 Aug 2015 21:50:13 +0100 Subject: [PATCH 05/10] colormaps format text --- doc/users/colormaps.rst | 117 ++++++++++++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 21 deletions(-) diff --git a/doc/users/colormaps.rst b/doc/users/colormaps.rst index 47e272d90bbb..5ed543ac2800 100644 --- a/doc/users/colormaps.rst +++ b/doc/users/colormaps.rst @@ -8,24 +8,37 @@ Choosing Colormaps Overview ======== -The idea behind choosing a good colormap is to find a good representation in 3D colorspace for your data set. The best colormap for any given data set depends on many things including: +The idea behind choosing a good colormap is to find a good representation in 3D +colorspace for your data set. The best colormap for any given data set depends +on many things including: - Whether representing form or metric data ([Ware]_) - Your knowledge of the data set (*e.g.*, is there a critical value from which the other values deviate?) - If there is an intuitive color scheme for the parameter you are plotting - If there is a standard in the field the audience may be expecting -For many applications, a perceptual colormap is the best choice --- one in which equal steps in data are perceived as equal steps in the color space. Researchers have found that the human brain perceives changes in the lightness parameter as changes in the data much better than, for example, changes in hue. Therefore, colormaps which have monotonically increasing lightness through the colormap will be better interpreted by the viewer. +For many applications, a perceptual colormap is the best choice --- one in which +equal steps in data are perceived as equal steps in the color space. Researchers +have found that the human brain perceives changes in the lightness parameter as +changes in the data much better than, for example, changes in hue. Therefore, +colormaps which have monotonically increasing lightness through the colormap +will be better interpreted by the viewer. -Color can be represented in 3D space in various ways. One way to represent color is using CIELAB. In CIELAB, color space is represented by lightness, :math:`L^*`; red-green, :math:`a^*`; and yellow-blue, :math:`b^*`. The lightness parameter :math:`L^*` can then be used to learn more about how the matplotlib colormaps will be perceived by viewers. +Color can be represented in 3D space in various ways. One way to represent color +is using CIELAB. In CIELAB, color space is represented by lightness, +:math:`L^*`; red-green, :math:`a^*`; and yellow-blue, :math:`b^*`. The lightness +parameter :math:`L^*` can then be used to learn more about how the matplotlib +colormaps will be perceived by viewers. -An excellent starting resource for learning about human perception of colormaps is from [IBM]_. +An excellent starting resource for learning about human perception of colormaps +is from [IBM]_. Classes of colormaps ==================== -Colormaps are often split into several categories based on their function (see, *e.g.*, [Moreland]_): +Colormaps are often split into several categories based on their function (see, +*e.g.*, [Moreland]_): 1. Sequential: change in lightness and often saturation of color incrementally, often using a single hue; should be used for representing information that has ordering. 2. Diverging: change in lightness and possibly saturation of two different colors that meet in the middle at an unsaturated color; should be used when the information being plotted has a critical middle value, such as topography or when the data deviates around zero. @@ -35,34 +48,65 @@ Colormaps are often split into several categories based on their function (see, Lightness of matplotlib colormaps ================================= -Here we examine the lightness values of the matplotlib colormaps. Note that some documentation on the colormaps is available ([list-colormaps]_). +Here we examine the lightness values of the matplotlib colormaps. Note that some +documentation on the colormaps is available ([list-colormaps]_). Sequential ---------- -For the Sequential plots, the lightness value increases monotonically through the colormaps. This is good. Some of the :math:`L^*` values in the colormaps span from 0 to 100 (binary and the other grayscale), and others start around :math:`L^*=20`. Those that have a smaller range of :math:`L^*` will accordingly have a smaller perceptual range. Note also that the :math:`L^*` function varies amongst the colormaps: some are approximately linear in :math:`L^*` and others are more curved. +For the Sequential plots, the lightness value increases monotonically through +the colormaps. This is good. Some of the :math:`L^*` values in the colormaps +span from 0 to 100 (binary and the other grayscale), and others start around +:math:`L^*=20`. Those that have a smaller range of :math:`L^*` will accordingly +have a smaller perceptual range. Note also that the :math:`L^*` function varies +amongst the colormaps: some are approximately linear in :math:`L^*` and others +are more curved. Sequential2 ----------- -Many of the :math:`L^*` values from the Sequential2 plots are monotonically increasing, but some (autumn, cool, spring, and winter) plateau or even go both up and down in :math:`L^*` space. Others (afmhot, copper, gist_heat, and hot) have kinks in the :math:`L^*` functions. Data that is being represented in a region of the colormap that is at a plateau or kink will lead to a perception of banding of the data in those values in the colormap (see [mycarta-banding]_ for an excellent example of this). +Many of the :math:`L^*` values from the Sequential2 plots are monotonically +increasing, but some (autumn, cool, spring, and winter) plateau or even go both +up and down in :math:`L^*` space. Others (afmhot, copper, gist_heat, and hot) +have kinks in the :math:`L^*` functions. Data that is being represented in a +region of the colormap that is at a plateau or kink will lead to a perception of +banding of the data in those values in the colormap (see [mycarta-banding]_ for +an excellent example of this). Diverging --------- -For the Diverging maps, we want to have monotonically increasing :math:`L^*` values up to a maximum, which should be close to :math:`L^*=100`, followed by monotonically decreasing :math:`L^*` values. We are looking for approximately equal minimum :math:`L^*` values at opposite ends of the colormap. By these measures, BrBG and RdBu are good options. coolwarm is a good option, but it doesn't span a wide range of :math:`L^*` values (see grayscale section below). +For the Diverging maps, we want to have monotonically increasing :math:`L^*` +values up to a maximum, which should be close to :math:`L^*=100`, followed by +monotonically decreasing :math:`L^*` values. We are looking for approximately +equal minimum :math:`L^*` values at opposite ends of the colormap. By these +measures, BrBG and RdBu are good options. coolwarm is a good option, but it +doesn't span a wide range of :math:`L^*` values (see grayscale section below). Qualitative ----------- -Qualitative colormaps are not aimed at being perceptual maps, but looking at the lightness parameter can verify that for us. The :math:`L^*` values move all over the place throughout the colormap, and are clearly not monotonically increasing. These would not be good options for use as perceptual colormaps. +Qualitative colormaps are not aimed at being perceptual maps, but looking at the +lightness parameter can verify that for us. The :math:`L^*` values move all over +the place throughout the colormap, and are clearly not monotonically increasing. +These would not be good options for use as perceptual colormaps. Miscellaneous ------------- -Some of the miscellaneous colormaps have particular uses they have been created for. For example, gist_earth, ocean, and terrain all seem to be created for plotting topography (green/brown) and water depths (blue) together. We would expect to see a divergence in these colormaps, then, but multiple kinks may not be ideal, such as in gist_earth and terrain. CMRmap was created to convert well to grayscale, though it does appear to have some small kinks in :math:`L^*`. cubehelix was created to vary smoothly in both lightness and hue, but appears to have a small hump in the green hue area. +Some of the miscellaneous colormaps have particular uses they have been created +for. For example, gist_earth, ocean, and terrain all seem to be created for +plotting topography (green/brown) and water depths (blue) together. We would +expect to see a divergence in these colormaps, then, but multiple kinks may not +be ideal, such as in gist_earth and terrain. CMRmap was created to convert well +to grayscale, though it does appear to have some small kinks in :math:`L^*`. +cubehelix was created to vary smoothly in both lightness and hue, but appears to +have a small hump in the green hue area. -The often-used jet colormap is included in this set of colormaps. We can see that the :math:`L^*` values vary widely throughout the colormap, making it a poor choice for representing data for viewers to see perceptually. See an extension on this idea at [mycarta-jet]_. +The often-used jet colormap is included in this set of colormaps. We can see +that the :math:`L^*` values vary widely throughout the colormap, making it a +poor choice for representing data for viewers to see perceptually. See an +extension on this idea at [mycarta-jet]_. .. plot:: users/plotting/colormaps/lightness.py @@ -70,7 +114,11 @@ The often-used jet colormap is included in this set of colormaps. We can see tha :math:`L^*` function ==================== -There are multiple approaches to finding the best function for :math:`L^*` across a colormap. Linear gives reasonable results (*e.g.*, [mycarta-banding]_, [mycarta-lablinear]_). However, the Weber-Fechner law, and more generally and recently, Stevens' Law, indicates that a logarithmic or geometric relationship might be better (see effort on this front at [mycarta-cubelaw]_). +There are multiple approaches to finding the best function for :math:`L^*` +across a colormap. Linear gives reasonable results (*e.g.*, [mycarta-banding]_, +[mycarta-lablinear]_). However, the Weber-Fechner law, and more generally and +recently, Stevens' Law, indicates that a logarithmic or geometric relationship +might be better (see effort on this front at [mycarta-cubelaw]_). .. plot:: users/plotting/colormaps/Lfunction.py @@ -78,11 +126,35 @@ There are multiple approaches to finding the best function for :math:`L^*` acros Grayscale conversion ==================== -Conversion to grayscale is important to pay attention to for printing publications that have color plots. If this is not paid attention to ahead of time, your readers may end up with indecipherable plots because the grayscale changes unpredictably through the colormap. - -Conversion to grayscale is done in many different ways [bw]_. Some of the better ones use a linear combination of the rgb values of a pixel, but weighted according to how we perceive color intensity. A nonlinear method of conversion to grayscale is to use the :math:`L^*` values of the pixels. In general, similar principles apply for this question as they do for presenting one's information perceptually; that is, if a colormap is chosen that has monotonically increasing in :math:`L^*` values, it will print in a reasonable manner to grayscale. - -With this in mind, we see that the Sequential colormaps have reasonable representations in grayscale. Some of the Sequential2 colormaps have decent enough grayscale representations, though some (autumn, spring, summer, winter) have very little grayscale change. If a colormap like this was used in a plot and then the plot was printed to grayscale, a lot of the information may map to the same gray values. The Diverging colormaps mostly vary from darker gray on the outer edges to white in the middle. Some (PuOr and seismic) have noticably darker gray on one side than the other and therefore are not very symmetric. coolwarm has little range of gray scale and would print to a more uniform plot, losing a lot of detail. Note that overlaid, labeled contours could help differentiate between one side of the colormap vs. the other since color cannot be used once a plot is printed to grayscale. Many of the Qualitative and Miscellaneous colormaps, such as Accent, hsv, and jet, change from darker to lighter and back to darker gray throughout the colormap. This would make it impossible for a viewer to interpret the information in a plot once it is printed in grayscale. +Conversion to grayscale is important to pay attention to for printing +publications that have color plots. If this is not paid attention to ahead of +time, your readers may end up with indecipherable plots because the grayscale +changes unpredictably through the colormap. + +Conversion to grayscale is done in many different ways [bw]_. Some of the better +ones use a linear combination of the rgb values of a pixel, but weighted +according to how we perceive color intensity. A nonlinear method of conversion +to grayscale is to use the :math:`L^*` values of the pixels. In general, similar +principles apply for this question as they do for presenting one's information +perceptually; that is, if a colormap is chosen that has monotonically increasing +in :math:`L^*` values, it will print in a reasonable manner to grayscale. + +With this in mind, we see that the Sequential colormaps have reasonable +representations in grayscale. Some of the Sequential2 colormaps have decent +enough grayscale representations, though some (autumn, spring, summer, winter) +have very little grayscale change. If a colormap like this was used in a plot +and then the plot was printed to grayscale, a lot of the information may map to +the same gray values. The Diverging colormaps mostly vary from darker gray on +the outer edges to white in the middle. Some (PuOr and seismic) have noticably +darker gray on one side than the other and therefore are not very symmetric. +coolwarm has little range of gray scale and would print to a more uniform plot, +losing a lot of detail. Note that overlaid, labeled contours could help +differentiate between one side of the colormap vs. the other since color cannot +be used once a plot is printed to grayscale. Many of the Qualitative and +Miscellaneous colormaps, such as Accent, hsv, and jet, change from darker to +lighter and back to darker gray throughout the colormap. This would make it +impossible for a viewer to interpret the information in a plot once it is +printed in grayscale. .. plot:: users/plotting/colormaps/grayscale.py @@ -90,9 +162,13 @@ With this in mind, we see that the Sequential colormaps have reasonable represen Color vision deficiencies ========================= -There is a lot of information available about color blindness available (*e.g.*, [colorblindness]_). Additionally, there are tools available to convert images to how they look for different types of color vision deficiencies (*e.g.*, [asp]_). +There is a lot of information available about color blindness available (*e.g.*, +[colorblindness]_). Additionally, there are tools available to convert images to +how they look for different types of color vision deficiencies (*e.g.*, [asp]_). -The most common form of color vision deficiency involves differentiating between red and green. Thus, avoiding colormaps with both red and green will avoid many problems in general. +The most common form of color vision deficiency involves differentiating between +red and green. Thus, avoiding colormaps with both red and green will avoid many +problems in general. References @@ -109,4 +185,3 @@ References .. [colorblindness] http://aspnetresources.com/tools/colorBlindness .. [asp] http://aspnetresources.com/tools/colorBlindness .. [IBM] http://www.research.ibm.com/people/l/lloydt/color/color.HTM - From db5f44326d36df699d628ae8efe6b99b9e347cfd Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 13:19:39 -0400 Subject: [PATCH 06/10] "perceptually uniform" Re: @stefanv's comment --- doc/users/colormaps.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/users/colormaps.rst b/doc/users/colormaps.rst index 5ed543ac2800..f3e1fdf0db70 100644 --- a/doc/users/colormaps.rst +++ b/doc/users/colormaps.rst @@ -17,11 +17,12 @@ on many things including: - If there is an intuitive color scheme for the parameter you are plotting - If there is a standard in the field the audience may be expecting -For many applications, a perceptual colormap is the best choice --- one in which -equal steps in data are perceived as equal steps in the color space. Researchers -have found that the human brain perceives changes in the lightness parameter as -changes in the data much better than, for example, changes in hue. Therefore, -colormaps which have monotonically increasing lightness through the colormap +For many applications, a perceptually uniform colormap is the best +choice --- one in which equal steps in data are perceived as equal +steps in the color space. Researchers have found that the human brain +perceives changes in the lightness parameter as changes in the data +much better than, for example, changes in hue. Therefore, colormaps +which have monotonically increasing lightness through the colormap will be better interpreted by the viewer. Color can be represented in 3D space in various ways. One way to represent color From db403c3a572872169e870e37ad0daeb94e5e9da6 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 13:19:58 -0400 Subject: [PATCH 07/10] Formatting only --- doc/users/colormaps.rst | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/users/colormaps.rst b/doc/users/colormaps.rst index f3e1fdf0db70..efaeb964535b 100644 --- a/doc/users/colormaps.rst +++ b/doc/users/colormaps.rst @@ -13,8 +13,12 @@ colorspace for your data set. The best colormap for any given data set depends on many things including: - Whether representing form or metric data ([Ware]_) -- Your knowledge of the data set (*e.g.*, is there a critical value from which the other values deviate?) + +- Your knowledge of the data set (*e.g.*, is there a critical value + from which the other values deviate?) + - If there is an intuitive color scheme for the parameter you are plotting + - If there is a standard in the field the audience may be expecting For many applications, a perceptually uniform colormap is the best @@ -41,9 +45,19 @@ Classes of colormaps Colormaps are often split into several categories based on their function (see, *e.g.*, [Moreland]_): -1. Sequential: change in lightness and often saturation of color incrementally, often using a single hue; should be used for representing information that has ordering. -2. Diverging: change in lightness and possibly saturation of two different colors that meet in the middle at an unsaturated color; should be used when the information being plotted has a critical middle value, such as topography or when the data deviates around zero. -3. Qualitative: often are miscellaneous colors; should be used to represent information which does not have ordering or relationships. +1. Sequential: change in lightness and often saturation of color + incrementally, often using a single hue; should be used for + representing information that has ordering. + +2. Diverging: change in lightness and possibly saturation of two + different colors that meet in the middle at an unsaturated color; + should be used when the information being plotted has a critical + middle value, such as topography or when the data deviates around + zero. + +3. Qualitative: often are miscellaneous colors; should be used to + represent information which does not have ordering or + relationships. Lightness of matplotlib colormaps From e3bdf44a4db6709590d8fd360dcacedd787d2470 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 13:20:59 -0400 Subject: [PATCH 08/10] Add new category for perceptually uniform colormaps Refactor to reduce duplication --- doc/users/plotting/colormaps/colormaps.py | 22 ++++++++++++ doc/users/plotting/colormaps/grayscale.py | 28 +++------------- doc/users/plotting/colormaps/lightness.py | 41 +++++++++-------------- examples/color/colormaps_reference.py | 20 +---------- 4 files changed, 43 insertions(+), 68 deletions(-) create mode 100644 doc/users/plotting/colormaps/colormaps.py diff --git a/doc/users/plotting/colormaps/colormaps.py b/doc/users/plotting/colormaps/colormaps.py new file mode 100644 index 000000000000..a7dbf27e38a9 --- /dev/null +++ b/doc/users/plotting/colormaps/colormaps.py @@ -0,0 +1,22 @@ +# Have colormaps separated into categories: +# http://matplotlib.org/examples/color/colormaps_reference.html + +cmaps = [('Perceptually Uniform Sequential', + ['viridis', 'inferno', 'plasma', 'magma']), + ('Sequential', ['Blues', 'BuGn', 'BuPu', + 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', + 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', + 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), + ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', + 'copper', 'gist_heat', 'gray', 'hot', + 'pink', 'spring', 'summer', 'winter']), + ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', + 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', + 'seismic']), + ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', + 'Pastel2', 'Set1', 'Set2', 'Set3']), + ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', + 'brg', 'CMRmap', 'cubehelix', + 'gnuplot', 'gnuplot2', 'gist_ncar', + 'nipy_spectral', 'jet', 'rainbow', + 'gist_rainbow', 'hsv', 'flag', 'prism'])] diff --git a/doc/users/plotting/colormaps/grayscale.py b/doc/users/plotting/colormaps/grayscale.py index 48a07539e598..4b9f91ab0935 100644 --- a/doc/users/plotting/colormaps/grayscale.py +++ b/doc/users/plotting/colormaps/grayscale.py @@ -4,9 +4,12 @@ ''' import colorconv as color + +from colormaps import cmaps + #from skimage import color -# we are using a local copy of colorconv from scikit-image to reduce dependencies. -# You should probably use the one from scikit-image in most cases. +# we are using a local copy of colorconv from scikit-image to reduce dependencies. +# You should probably use the one from scikit-image in most cases. import numpy as np import matplotlib.pyplot as plt from matplotlib import cm @@ -24,27 +27,6 @@ mpl.rcParams['mathtext.sf'] = 'sans' mpl.rcParams['mathtext.fallback_to_cm'] = 'True' -# Have colormaps separated into categories: -# http://matplotlib.org/examples/color/colormaps_reference.html - -cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', - 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', - 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', - 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), - ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'inferno', 'magma', - 'pink', 'plasma', 'spring', 'summer', 'viridis', - 'winter']), - ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', - 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', - 'seismic']), - ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', - 'Pastel2', 'Set1', 'Set2', 'Set3']), - ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', - 'brg', 'CMRmap', 'cubehelix', - 'gnuplot', 'gnuplot2', 'gist_ncar', - 'nipy_spectral', 'jet', 'rainbow', - 'gist_rainbow', 'hsv', 'flag', 'prism'])] # indices to step through colormap x = np.linspace(0.0, 1.0, 100) diff --git a/doc/users/plotting/colormaps/lightness.py b/doc/users/plotting/colormaps/lightness.py index e094fb58e13a..2a2edbb08ebe 100644 --- a/doc/users/plotting/colormaps/lightness.py +++ b/doc/users/plotting/colormaps/lightness.py @@ -1,14 +1,15 @@ ''' -For each colormap, plot the lightness parameter L* from CIELAB colorspace -along the y axis vs index through the colormap. Colormaps are examined in +For each colormap, plot the lightness parameter L* from CIELAB colorspace +along the y axis vs index through the colormap. Colormaps are examined in categories as in the original matplotlib gallery of colormaps. ''' import colorconv as color +from colormaps import cmaps #from skimage import color # we are using a local copy of colorconv from scikit-image to # reduce dependencies. -# You should probably use the one from scikit-image in most cases. +# You should probably use the one from scikit-image in most cases. import numpy as np import matplotlib.pyplot as plt from matplotlib import cm @@ -26,28 +27,6 @@ mpl.rcParams['mathtext.sf'] = 'sans' mpl.rcParams['mathtext.fallback_to_cm'] = 'True' -# Have colormaps separated into categories: -# http://matplotlib.org/examples/color/colormaps_reference.html - -cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', - 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', - 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', - 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), - ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'inferno', 'magma', - 'pink', 'plasma', 'spring', 'summer', 'viridis', - 'winter']), - ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', - 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', - 'seismic']), - ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', - 'Pastel2', 'Set1', 'Set2', 'Set3']), - ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', - 'brg', 'CMRmap', 'cubehelix', - 'gnuplot', 'gnuplot2', 'gist_ncar', - 'nipy_spectral', 'jet', 'rainbow', - 'gist_rainbow', 'hsv', 'flag', 'prism'])] - # indices to step through colormap x = np.linspace(0.0, 1.0, 100) @@ -84,7 +63,17 @@ # 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=='Sequential': + 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, + s=300, linewidths=0.) + if i==2: + ax.axis([-0.1,4.1,0,100]) + else: + ax.axis([-0.1,4.7,0,100]) + locs.append(x[-1]+j*dc) # store locations for colormap labels + + elif cmap_category=='Sequential': dc = 0.6 # spacing between colormaps ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap + '_r', s=300, linewidths=0.) diff --git a/examples/color/colormaps_reference.py b/examples/color/colormaps_reference.py index 00abb22f634a..ed5a7b7499c0 100644 --- a/examples/color/colormaps_reference.py +++ b/examples/color/colormaps_reference.py @@ -35,25 +35,7 @@ import numpy as np import matplotlib.pyplot as plt - -cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', - 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', - 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', - 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), - ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', - 'gist_heat', 'gray', 'hot', 'inferno', 'magma', - 'pink', 'plasma', 'spring', 'summer', 'viridis', - 'winter']), - ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', - 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', - 'seismic']), - ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', - 'Pastel2', 'Set1', 'Set2', 'Set3']), - ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', - 'brg', 'CMRmap', 'cubehelix', - 'gnuplot', 'gnuplot2', 'gist_ncar', - 'nipy_spectral', 'jet', 'rainbow', - 'gist_rainbow', 'hsv', 'flag', 'prism'])] +from colormaps import cmaps nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) From ba19f2bbb494b3d969178250c7c27915dd4c9721 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 16:05:11 -0400 Subject: [PATCH 09/10] Can't reuse mapping here. --- examples/color/colormaps_reference.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/examples/color/colormaps_reference.py b/examples/color/colormaps_reference.py index ed5a7b7499c0..e7ff56dea745 100644 --- a/examples/color/colormaps_reference.py +++ b/examples/color/colormaps_reference.py @@ -35,7 +35,28 @@ import numpy as np import matplotlib.pyplot as plt -from colormaps import cmaps +# Have colormaps separated into categories: +# http://matplotlib.org/examples/color/colormaps_reference.html + +cmaps = [('Perceptually Uniform Sequential', + ['viridis', 'inferno', 'plasma', 'magma']), + ('Sequential', ['Blues', 'BuGn', 'BuPu', + 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', + 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', + 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']), + ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', + 'copper', 'gist_heat', 'gray', 'hot', + 'pink', 'spring', 'summer', 'winter']), + ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr', + 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', + 'seismic']), + ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', + 'Pastel2', 'Set1', 'Set2', 'Set3']), + ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', + 'brg', 'CMRmap', 'cubehelix', + 'gnuplot', 'gnuplot2', 'gist_ncar', + 'nipy_spectral', 'jet', 'rainbow', + 'gist_rainbow', 'hsv', 'flag', 'prism'])] nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps) From e01552c68b93dab70919d9fd060bb3082890a079 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 21 Oct 2015 11:12:14 -0400 Subject: [PATCH 10/10] Address @QuLogic's feedback --- doc/users/colormaps.rst | 28 ++++++++++++----------- doc/users/plotting/colormaps/Lfunction.py | 11 +++++---- doc/users/plotting/colormaps/grayscale.py | 5 ++-- doc/users/plotting/colormaps/lightness.py | 5 ++-- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/doc/users/colormaps.rst b/doc/users/colormaps.rst index efaeb964535b..ad915ca259b3 100644 --- a/doc/users/colormaps.rst +++ b/doc/users/colormaps.rst @@ -109,14 +109,15 @@ These would not be good options for use as perceptual colormaps. Miscellaneous ------------- -Some of the miscellaneous colormaps have particular uses they have been created -for. For example, gist_earth, ocean, and terrain all seem to be created for -plotting topography (green/brown) and water depths (blue) together. We would -expect to see a divergence in these colormaps, then, but multiple kinks may not -be ideal, such as in gist_earth and terrain. CMRmap was created to convert well -to grayscale, though it does appear to have some small kinks in :math:`L^*`. -cubehelix was created to vary smoothly in both lightness and hue, but appears to -have a small hump in the green hue area. +Some of the miscellaneous colormaps have particular uses for which +they have been created. For example, gist_earth, ocean, and terrain +all seem to be created for plotting topography (green/brown) and water +depths (blue) together. We would expect to see a divergence in these +colormaps, then, but multiple kinks may not be ideal, such as in +gist_earth and terrain. CMRmap was created to convert well to +grayscale, though it does appear to have some small kinks in +:math:`L^*`. cubehelix was created to vary smoothly in both lightness +and hue, but appears to have a small hump in the green hue area. The often-used jet colormap is included in this set of colormaps. We can see that the :math:`L^*` values vary widely throughout the colormap, making it a @@ -141,17 +142,18 @@ might be better (see effort on this front at [mycarta-cubelaw]_). Grayscale conversion ==================== -Conversion to grayscale is important to pay attention to for printing -publications that have color plots. If this is not paid attention to ahead of -time, your readers may end up with indecipherable plots because the grayscale -changes unpredictably through the colormap. +It is important to pay attention to conversion to grayscale for color +plots, since they may be printed on black and white printers. If not +carefully considered, your readers may end up with indecipherable +plots because the grayscale changes unpredictably through the +colormap. Conversion to grayscale is done in many different ways [bw]_. Some of the better ones use a linear combination of the rgb values of a pixel, but weighted according to how we perceive color intensity. A nonlinear method of conversion to grayscale is to use the :math:`L^*` values of the pixels. In general, similar principles apply for this question as they do for presenting one's information -perceptually; that is, if a colormap is chosen that has monotonically increasing +perceptually; that is, if a colormap is chosen that is monotonically increasing in :math:`L^*` values, it will print in a reasonable manner to grayscale. With this in mind, we see that the Sequential colormaps have reasonable diff --git a/doc/users/plotting/colormaps/Lfunction.py b/doc/users/plotting/colormaps/Lfunction.py index 1e0777c93034..4eae8bb07aba 100644 --- a/doc/users/plotting/colormaps/Lfunction.py +++ b/doc/users/plotting/colormaps/Lfunction.py @@ -7,15 +7,16 @@ import matplotlib.pyplot as plt import colorconv as color #from skimage import color -# we are using a local copy of colorconv from scikit-image to reduce dependencies. -# You should probably use the one from scikit-image in most cases. +# we are using a local copy of colorconv from scikit-image to reduce dependencies. +# You should probably use the one from scikit-image in most cases. import matplotlib as mpl from matplotlib import cm mpl.rcParams.update({'font.size': 12}) -mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' -'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, ' + 'Lucida Grande, Verdana, Geneva, Lucid, ' + 'Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans' @@ -161,7 +162,7 @@ # common ylabel ax1.text(-0.3, 4.5, 'Steps through map indices', - rotation=90, transform=ax1.transAxes) + rotation=90, transform=ax1.transAxes) fig.subplots_adjust(hspace=0.0) plt.show() diff --git a/doc/users/plotting/colormaps/grayscale.py b/doc/users/plotting/colormaps/grayscale.py index 4b9f91ab0935..3cfa583a044f 100644 --- a/doc/users/plotting/colormaps/grayscale.py +++ b/doc/users/plotting/colormaps/grayscale.py @@ -16,8 +16,9 @@ import matplotlib as mpl mpl.rcParams.update({'font.size': 14}) -mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' -'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, ' + 'Lucida Grande, Verdana, Geneva, Lucid, ' + 'Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans' diff --git a/doc/users/plotting/colormaps/lightness.py b/doc/users/plotting/colormaps/lightness.py index 2a2edbb08ebe..436f959a9b30 100644 --- a/doc/users/plotting/colormaps/lightness.py +++ b/doc/users/plotting/colormaps/lightness.py @@ -16,8 +16,9 @@ import matplotlib as mpl mpl.rcParams.update({'font.size': 12}) -mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans,' -'Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif') +mpl.rcParams['font.sans-serif'] = ('Arev Sans, Bitstream Vera Sans, ' + 'Lucida Grande, Verdana, Geneva, Lucid, ' + 'Helvetica, Avant Garde, sans-serif') mpl.rcParams['mathtext.fontset'] = 'custom' mpl.rcParams['mathtext.cal'] = 'cursive' mpl.rcParams['mathtext.rm'] = 'sans'