ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 18 Sep 2014 14:49:34 +0200How to make a custom divergent colormap?https://ask.sagemath.org/question/24180/how-to-make-a-custom-divergent-colormap/How can I make a custom diverging colormap in Sage?
What I want is the same than the reverse `seismic` diverging colormap ([Diverging Colormaps](http://matplotlib.org/examples/color/colormaps_reference.html)) but the blue value should be less intense (e. g. conflower blue [Hex color code: #6495ED]).
In the sage source code I found the following link [Diverging Colormaps](http://www.sandia.gov/~kmorel/documents/ColorMaps/), which explains the divergent colormaps and has a python class in the attachments. But still I have no clue to make such a diverging colormap.
I have also tried to make it with a LinearSegementedColormap:
from pylab import *
startcolor = '#FF0000'
midcolor = '#FFFFFF'
endcolor = '#0030CC'
own_cmap1 = matplotlib.colors.LinearSegmentedColormap.from_list( 'own2', [startcolor, midcolor, endcolor] )
matrix_plot( matrix( [ [1,3,5,1], [2,4,5,6], [1,-3,5,7] ] ), cmap = own_cmap1, colorbar = True )
but the result is absolutely not what I want, because it goes too fast from red into pink.
balduinThu, 18 Sep 2014 14:49:34 +0200https://ask.sagemath.org/question/24180/