Discussion:
How to set colormap scaling for image plot?
Eric
2013-03-08 00:08:31 UTC
Permalink
I've been trying to figure out how to explicitly set the colormap scaling
for an image plot such that it does not rescale to min/max when set_data is
called. I'm using an ImageDialog with an ImageItem to display realtime
data with freq (X axis) vs time (Y axis) vs power (Z axis/color). When I
set the Zaxis scale through the GUI, it changes until the next set_data.
I'd like to turn off that auto-scaling for the Z axis or at least find a
way programmatically to set it explicitly.

Any thoughts? It may be that there is something better than ImagePlot to
display the data (pcolor didn't seem right because it appears to require a
'square' plot area which I don't have).

Thanks,
Eric
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Carlos Pascual
2013-03-08 10:59:11 UTC
Permalink
I had a similar problem and I solved it by passing the current range on each
call to the set_data method:

++++++++++++++++
from guiqwt.image import ImageItem
im = ImageItem()
(...)
newdata = (...)
#when you want to set new data to the image:
r = im.get_lut_range() #this is the current range of the Zaxis
if r[0] == r[1]: r = None #if it was not set not set, let it autoscale
im.set_data(newdata, lut_range=r)
+++++++++++++++++

I do not know if there are better methods, but this one works for me.
IMHO, it should be possible (maybe it is) to call set_data with a flag that
respects the previous LUT range
Post by Eric
I've been trying to figure out how to explicitly set the colormap scaling
for an image plot such that it does not rescale to min/max when set_data is
called. I'm using an ImageDialog with an ImageItem to display realtime
data with freq (X axis) vs time (Y axis) vs power (Z axis/color). When I
set the Zaxis scale through the GUI, it changes until the next set_data.
I'd like to turn off that auto-scaling for the Z axis or at least find a
way programmatically to set it explicitly.
Any thoughts? It may be that there is something better than ImagePlot to
display the data (pcolor didn't seem right because it appears to require a
'square' plot area which I don't have).
Thanks,
Eric
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Eric
2013-03-17 02:32:25 UTC
Permalink
Thanks Carlos - that's what I was looking for. I'd prefer an easy
'autoscale = False' method but that works just fine.

Eric
Post by Carlos Pascual
I had a similar problem and I solved it by passing the current range on each
++++++++++++++++
from guiqwt.image import ImageItem
im = ImageItem()
(...)
newdata = (...)
r = im.get_lut_range() #this is the current range of the Zaxis
if r[0] == r[1]: r = None #if it was not set not set, let it autoscale
im.set_data(newdata, lut_range=r)
+++++++++++++++++
I do not know if there are better methods, but this one works for me.
IMHO, it should be possible (maybe it is) to call set_data with a flag that
respects the previous LUT range
Post by Eric
I've been trying to figure out how to explicitly set the colormap
scaling
Post by Eric
for an image plot such that it does not rescale to min/max when set_data
is
Post by Eric
called. I'm using an ImageDialog with an ImageItem to display realtime
data with freq (X axis) vs time (Y axis) vs power (Z axis/color). When
I
Post by Eric
set the Zaxis scale through the GUI, it changes until the next set_data.
I'd like to turn off that auto-scaling for the Z axis or at least find
a
Post by Eric
way programmatically to set it explicitly.
Any thoughts? It may be that there is something better than ImagePlot
to
Post by Eric
display the data (pcolor didn't seem right because it appears to require
a
Post by Eric
'square' plot area which I don't have).
Thanks,
Eric
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
Phone: +34 93 592 4428
+----------------------------------------------------+
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...