allow to set color map
This commit is contained in:
@ -1,16 +1,18 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pyqtgraph as pg
|
||||||
from .desc import Description
|
from .desc import Description
|
||||||
|
|
||||||
|
|
||||||
class ImageDescription(Description):
|
class ImageDescription(Description):
|
||||||
|
|
||||||
def __init__(self, name, title=None, xlabel=None, ylabel=None, image=None, levels=None):
|
def __init__(self, name, title=None, xlabel=None, ylabel=None, image=None, levels=None, cmap="viridis"):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.title = title
|
self.title = title
|
||||||
self.xlabel = xlabel
|
self.xlabel = xlabel
|
||||||
self.ylabel = ylabel
|
self.ylabel = ylabel
|
||||||
self.image = image
|
self.image = image
|
||||||
self.levels = levels #TODO: might be better to use vmin and vmax
|
self.levels = levels #TODO: might be better to use vmin and vmax
|
||||||
|
self.cmap = cmap
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self):
|
||||||
@ -40,6 +42,10 @@ class ImageDescription(Description):
|
|||||||
if self.ylabel:
|
if self.ylabel:
|
||||||
plotwidget.getView().setLabel("left", self.ylabel)
|
plotwidget.getView().setLabel("left", self.ylabel)
|
||||||
|
|
||||||
|
if self.cmap:
|
||||||
|
cm = pg.colormap.get(self.cmap)
|
||||||
|
plotwidget.setColorMap(cm)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user