Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-19 Thread Jae-Joon Lee
As far as I can see, this is a bug of matplolib, although calling a
set_data work around this. Can you open a bug report in our github repo?

-JJ
 2012. 2. 18. 오후 10:12에 Ray Osborn rosb...@anl.gov님이 작성:

 You're exactly right. That does fix it. Unfortunately, it means I have to
 refactor some of my code because the Pyside slot doesn't currently have
 access to the original data, but that's not a huge deal.

 Thanks,
 Ray

 On Feb 18, 2012, at 4:35 AM, Jerzy Karczmarczuk wrote:

  Ray Osborn:
 
  OK - it turns out I can reproduce it in a simple ipython session using
 ipython --pylab=qt.
 
  I set up an image plot as follows:
 
  import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib.image import NonUniformImage
 
  x=y=np.linspace(0,2*np.pi,101)
  X,Y=np.meshgrid(x,y)
  z=sin(X)*sin(Y)
 
  ax=plt.gca()
  extent = (x[0],x[-1],y[0],y[-1])
  im = NonUniformImage(ax, extent=extent, origin=None)
  im.set_data(x,y,z)
 
  ax.images.append(im)
  ax.set_xlim(x[0],x[-1])
  ax.set_ylim(y[0],y[-1])
 
  plt.colorbar(im)
 
  plt.gcf().canvas.draw()
 
 
  After that, I try to change the color scale using:
 
  im.set_clim(0,0.5)
  plt.gcf().canvas.draw()
 
  The colorbar changes scale, but the plot is untouched. Is that the
 expected behavior?
 
  Thanks,
  Ray
 
  Try, perhaps, after set_clim, to reinstall the data:
 
  im.set_data(x,y,z)
  plt.gcf().canvas.draw()
 
  =
 
  Jerzy Karczmarczuk
 
 
 --
  Virtualization  Cloud Management Using Capacity Planning
  Cloud computing makes use of virtualization - but cloud computing
  also focuses on allowing computing to be delivered as a service.
 
 http://www.accelacomm.com/jaw/sfnl/114/51521223/___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 --
 Ray Osborn
 Materials Science Division
 Argonne National Laboratory
 Argonne, IL 60439, USA
 Phone: +1 (630) 252-9011
 Email: rosb...@anl.gov





 --
 Virtualization  Cloud Management Using Capacity Planning
 Cloud computing makes use of virtualization - but cloud computing
 also focuses on allowing computing to be delivered as a service.
 http://www.accelacomm.com/jaw/sfnl/114/51521223/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-19 Thread Ray Osborn
I think you're right. Even if there is a work-around, it can't be right for the 
colorbar to change without affecting the image. I've filed issue #708.

Thanks,
Ray

On Feb 19, 2012, at 4:37 AM, Jae-Joon Lee wrote:

 As far as I can see, this is a bug of matplolib, although calling a set_data 
 work around this. Can you open a bug report in our github repo?
 
 -JJ
 2012. 2. 18. 오후 10:12에 Ray Osborn rosb...@anl.gov님이 작성:
 You're exactly right. That does fix it. Unfortunately, it means I have to 
 refactor some of my code because the Pyside slot doesn't currently have 
 access to the original data, but that's not a huge deal.
 
 Thanks,
 Ray
 
 On Feb 18, 2012, at 4:35 AM, Jerzy Karczmarczuk wrote:
 
  Ray Osborn:
 
  OK - it turns out I can reproduce it in a simple ipython session using 
  ipython --pylab=qt.
 
  I set up an image plot as follows:
 
  import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib.image import NonUniformImage
 
  x=y=np.linspace(0,2*np.pi,101)
  X,Y=np.meshgrid(x,y)
  z=sin(X)*sin(Y)
 
  ax=plt.gca()
  extent = (x[0],x[-1],y[0],y[-1])
  im = NonUniformImage(ax, extent=extent, origin=None)
  im.set_data(x,y,z)
 
  ax.images.append(im)
  ax.set_xlim(x[0],x[-1])
  ax.set_ylim(y[0],y[-1])
 
  plt.colorbar(im)
 
  plt.gcf().canvas.draw()
 
 
  After that, I try to change the color scale using:
 
  im.set_clim(0,0.5)
  plt.gcf().canvas.draw()
 
  The colorbar changes scale, but the plot is untouched. Is that the 
  expected behavior?
 
  Thanks,
  Ray
 
  Try, perhaps, after set_clim, to reinstall the data:
 
  im.set_data(x,y,z)
  plt.gcf().canvas.draw()
 
  =
 
  Jerzy Karczmarczuk
 
  --
  Virtualization  Cloud Management Using Capacity Planning
  Cloud computing makes use of virtualization - but cloud computing
  also focuses on allowing computing to be delivered as a service.
  http://www.accelacomm.com/jaw/sfnl/114/51521223/___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 Ray Osborn
 Materials Science Division
 Argonne National Laboratory
 Argonne, IL 60439, USA
 Phone: +1 (630) 252-9011
 Email: rosb...@anl.gov
 
 
 
 
 --
 Virtualization  Cloud Management Using Capacity Planning
 Cloud computing makes use of virtualization - but cloud computing
 also focuses on allowing computing to be delivered as a service.
 http://www.accelacomm.com/jaw/sfnl/114/51521223/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: rosb...@anl.gov



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-18 Thread Jerzy Karczmarczuk

Ray Osborn:
OK - it turns out I can reproduce it in a simple ipython session using 
ipython --pylab=qt.


I set up an image plot as follows:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage

x=y=np.linspace(0,2*np.pi,101)
X,Y=np.meshgrid(x,y)
z=sin(X)*sin(Y)

ax=plt.gca()
extent = (x[0],x[-1],y[0],y[-1])
im = NonUniformImage(ax, extent=extent, origin=None)
im.set_data(x,y,z)

ax.images.append(im)
ax.set_xlim(x[0],x[-1])
ax.set_ylim(y[0],y[-1])

plt.colorbar(im)

plt.gcf().canvas.draw()


After that, I try to change the color scale using:

im.set_clim(0,0.5)
plt.gcf().canvas.draw()

The colorbar changes scale, but the plot is untouched. Is that the 
expected behavior?


Thanks,
Ray


Try, perhaps, after set_clim, to reinstall the data:

im.set_data(x,y,z)
plt.gcf().canvas.draw()

=

Jerzy Karczmarczuk

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-18 Thread Ray Osborn
You're exactly right. That does fix it. Unfortunately, it means I have to 
refactor some of my code because the Pyside slot doesn't currently have access 
to the original data, but that's not a huge deal.

Thanks,
Ray

On Feb 18, 2012, at 4:35 AM, Jerzy Karczmarczuk wrote:

 Ray Osborn:
 
 OK - it turns out I can reproduce it in a simple ipython session using 
 ipython --pylab=qt. 
 
 I set up an image plot as follows:
 
 import numpy as np
 import matplotlib.pyplot as plt
 from matplotlib.image import NonUniformImage
 
 x=y=np.linspace(0,2*np.pi,101)
 X,Y=np.meshgrid(x,y)
 z=sin(X)*sin(Y)
 
 ax=plt.gca()
 extent = (x[0],x[-1],y[0],y[-1])
 im = NonUniformImage(ax, extent=extent, origin=None)
 im.set_data(x,y,z)
 
 ax.images.append(im)
 ax.set_xlim(x[0],x[-1])
 ax.set_ylim(y[0],y[-1])
 
 plt.colorbar(im)
 
 plt.gcf().canvas.draw()
 
 
 After that, I try to change the color scale using:
 
 im.set_clim(0,0.5)
 plt.gcf().canvas.draw()
 
 The colorbar changes scale, but the plot is untouched. Is that the expected 
 behavior?
 
 Thanks,
 Ray
 
 Try, perhaps, after set_clim, to reinstall the data:
 
 im.set_data(x,y,z)
 plt.gcf().canvas.draw()
 
 =
 
 Jerzy Karczmarczuk
 
 --
 Virtualization  Cloud Management Using Capacity Planning
 Cloud computing makes use of virtualization - but cloud computing 
 also focuses on allowing computing to be delivered as a service.
 http://www.accelacomm.com/jaw/sfnl/114/51521223/___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: rosb...@anl.gov




--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-17 Thread Ray Osborn
I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a 
slider to adjust the color scale of a 2D plot made using NonUnitformImage. I am 
connecting the slider value to im.set_clim([vmin,vmax]). I have got my axis 
sliders to work, but the intensity slider only adjusts the colorbar without 
touching the image itself. Is there some trick to making this work with 
NonUniformImage?

My plotting routine has the following code:

ax = plt.gca()
im = NonUniformImage(ax, extent=extent, origin=None, **opts)
im.set_data(x,y,z)
ax.images.append(im)
self.imgplot = im
plt.colorbar(im)

while the Pyside slot has:

zhi = self.zmin + (self.ztab.maxslider.value() * range / 100)
im = self.imgplot
im.set_clim([zlo,zhi])

The slider dynamically adjusts the colorbar beautifully, but leaves the color 
plot untouched. Any suggestions welcome.

Thanks in advance,
Ray
-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: rosb...@anl.gov




--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-17 Thread Benjamin Root
On Friday, February 17, 2012, Ray Osborn wrote:

 I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a
 slider to adjust the color scale of a 2D plot made using NonUnitformImage.
 I am connecting the slider value to im.set_clim([vmin,vmax]). I have got my
 axis sliders to work, but the intensity slider only adjusts the colorbar
 without touching the image itself. Is there some trick to making this work
 with NonUniformImage?

 My plotting routine has the following code:

ax = plt.gca()
im = NonUniformImage(ax, extent=extent, origin=None, **opts)
im.set_data(x,y,z)
ax.images.append(im)
self.imgplot = im
plt.colorbar(im)

 while the Pyside slot has:

zhi = self.zmin + (self.ztab.maxslider.value() * range / 100)
im = self.imgplot
im.set_clim([zlo,zhi])

 The slider dynamically adjusts the colorbar beautifully, but leaves the
 color plot untouched. Any suggestions welcome.

 Thanks in advance,
 Ray


Without a more complete example, it is hard to say. Can you make a small
stand-alone example that we can try out?

Ben Root
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage

2012-02-17 Thread Ray Osborn
OK - it turns out I can reproduce it in a simple ipython session using ipython 
--pylab=qt. 

I set up an image plot as follows:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage

x=y=np.linspace(0,2*np.pi,101)
X,Y=np.meshgrid(x,y)
z=sin(X)*sin(Y)

ax=plt.gca()
extent = (x[0],x[-1],y[0],y[-1])
im = NonUniformImage(ax, extent=extent, origin=None)
im.set_data(x,y,z)

ax.images.append(im)
ax.set_xlim(x[0],x[-1])
ax.set_ylim(y[0],y[-1])

plt.colorbar(im)

plt.gcf().canvas.draw()


After that, I try to change the color scale using:

im.set_clim(0,0.5)
plt.gcf().canvas.draw()

The colorbar changes scale, but the plot is untouched. Is that the expected 
behavior?

Thanks,
Ray

On Feb 17, 2012, at 9:05 PM, Benjamin Root wrote:

 
 
 On Friday, February 17, 2012, Ray Osborn wrote:
 I am embedding a matplotlib canvas in a Pyside GUI and wanted to attach a 
 slider to adjust the color scale of a 2D plot made using NonUnitformImage. I 
 am connecting the slider value to im.set_clim([vmin,vmax]). I have got my 
 axis sliders to work, but the intensity slider only adjusts the colorbar 
 without touching the image itself. Is there some trick to making this work 
 with NonUniformImage?
 
 My plotting routine has the following code:
 
ax = plt.gca()
im = NonUniformImage(ax, extent=extent, origin=None, **opts)
im.set_data(x,y,z)
ax.images.append(im)
self.imgplot = im
plt.colorbar(im)
 
 while the Pyside slot has:
 
zhi = self.zmin + (self.ztab.maxslider.value() * range / 100)
im = self.imgplot
im.set_clim([zlo,zhi])
 
 The slider dynamically adjusts the colorbar beautifully, but leaves the color 
 plot untouched. Any suggestions welcome.
 
 Thanks in advance,
 Ray
 
 Without a more complete example, it is hard to say. Can you make a small 
 stand-alone example that we can try out?
 
 Ben Root
 

-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: rosb...@anl.gov



--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users