Changing the colormap for cameragui #95
-
How could one change the colormap of camera_gui? The default seems to be 'inferno', however it would be nice if it would be possible to change it. I initially thought it could be changed 'camera_logic.py', in the function draw_3d_image. Sadly, even after changing the cmap there and reseting qudi, the camera_gui still plots the camera image in the default colormap. Does anyone know the way to do it? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @mario-b-amaro , The plotting code you can find in any logic module is just responsible for creating a thumbnail image using If you really need to change the colorscale now, you can do it the ugly way by altering self.image_widget.image_item.setLookupTable(ColorScaleViridis().lut)
grad = QtGui.QLinearGradient(0, 0, 0, 1)
grad.setCoordinateMode(QtGui.QGradient.ObjectMode)
for stop, color in zip(*ColorScaleViridis().colormap.getStops('byte')):
grad.setColorAt(stop, QtGui.QColor(*color))
self.image_widget.colorbar_widget.colorbar.setOpts(brush=QtGui.QBrush(grad))
|
Beta Was this translation helpful? Give feedback.
Hi @mario-b-amaro ,
The plotting code you can find in any logic module is just responsible for creating a thumbnail image using
matplotlib
that is saved to file alongside the measurement data.matplotlib
has a nice interface to set the colorscale via keyword (inferno
,rainbow
etc.). But the plotting widgets of the GUI modules do not usematplotlib
butQt for Python (PySide2)
.Currently there is no concise interface to change the colorscale of a GUI plotwidget (from
qudi.util.widgets.plotting
) via a simple function call. It would be nice to have this functionality, so feel free to file a feature request inqudi-core
.If you really need to change the colorscale now, you can do it the ugly w…