Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to make a custom divergent colormap?

How can I make a custom divergent colormap in Sage? What I want is the same than the reverse seismic divergend colormap (Divergend Colormaps) but the blue value schould be less intensiv (e. g. conflower blue [Hex color code: #6495ED]).

In the sage source code I found the following link Divergend Colormaps, which explains the divergent colormaps and has a python class in the attachments. But still I have no clue to make such a divergent colormap.

I have also tryed 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 to fast from red into pink.

How to make a custom divergent colormap?

How can I make a custom divergent diverging colormap in Sage? What I want is the same than the reverse seismic divergend diverging colormap (Divergend Diverging Colormaps) but the blue value schould should be less intensiv intense (e. g. conflower blue [Hex color code: #6495ED]).

In the sage source code I found the following link Divergend Diverging Colormaps, which explains the divergent colormaps and has a python class in the attachments. But still I have no clue to make such a divergent diverging colormap.

I have also tryed tried to make it with a LinearSegementedColormap:
LinearSegementedColormap:

 from pylab import * 
* startcolor = '#FF0000'
'#FF0000' midcolor = '#FFFFFF'
'#FFFFFF' endcolor = '#0030CC'
'#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 to too fast from red into pink.