added method to use predefined colormaps
This commit is contained in:
parent
4fda285e08
commit
ee2595c008
|
@ -318,6 +318,26 @@ class Colormap():
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
def usePredefined(self,name='bluered'):
|
||||||
|
mycolormaps = {
|
||||||
|
'gray': [Color('HSL',[0,1,1]), Color('HSL',[0,0,0.15])],
|
||||||
|
'grey': [Color('HSL',[0,1,1]), Color('HSL',[0,0,0.15])],
|
||||||
|
'red': [Color('HSL',[0,1,0.14]), Color('HSL',[0,0.35,0.91])],
|
||||||
|
'green': [Color('HSL',[0.33333,1,0.14]), Color('HSL',[0.33333,0.35,0.91])],
|
||||||
|
'blue': [Color('HSL',[0.66,1,0.14]), Color('HSL',[0.66,0.35,0.91])],
|
||||||
|
'seaweed': [Color('HSL',[0.78,1.0,0.1]), Color('HSL',[0.40000,0.1,0.9])],
|
||||||
|
'bluebrown': [Color('HSL',[0.65,0.53,0.49]), Color('HSL',[0.11,0.75,0.38])],
|
||||||
|
'redgreen': [Color('HSL',[0.97,0.96,0.36]), Color('HSL',[0.33333,1.0,0.14])],
|
||||||
|
'bluered': [Color('HSL',[0.65,0.53,0.49]), Color('HSL',[0.97,0.96,0.36])],
|
||||||
|
}
|
||||||
|
if name.lower() not in mycolormaps:
|
||||||
|
raise KeyError('colormap "%s" is not defined, use one of "%s"'%(name,'" "'.join(mycolormaps.keys())))
|
||||||
|
self.left = mycolormaps[name.lower()][0].expressAs('MSH')
|
||||||
|
self.right= mycolormaps[name.lower()][1].expressAs('MSH')
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
def export(self,name = 'uniformPerceptualColorMap',\
|
def export(self,name = 'uniformPerceptualColorMap',\
|
||||||
format = 'paraview',\
|
format = 'paraview',\
|
||||||
|
|
Loading…
Reference in New Issue