Re: [Matplotlib-users] range in the colorbar

2010-10-22 Thread Alexander Dietz
Hi Eric,

thanks a lot, that was exactly I was looking for...


Alex

On Thu, Oct 21, 2010 at 20:23, Eric Firing efir...@hawaii.edu wrote:

 On 10/20/2010 11:41 PM, Alexander Dietz wrote:
  Hi,
 
  I am generating a scatter plot with a colorbar, and want to pass on the
  colorbar to some function to do something with it, like
 
  plt.scatter(px, py, c=pz, ...)
  cb = plt.colorbar()
  foo(cb)
 
 
  My question: How can I extract the range of the colorbar from the cb
  object? The colorbar extends from min(pz) to max(pz), but can I access
  these values from the cb object alone, without the need to pass pz to
  foo as well?

 cb.norm.vmin
 cb.norm.vmax

 Or you can get the same thing from the collection returned by scatter:

 col = scatter(...)
 col.norm.vmin
 col.norm.vmax

 The colorbar uses the norm and colormap from the current image (or more
 generally, the color-mappable object), which in this case is the
 collection generated by scatter().

 Eric

 
 
  Thanks
 Alex
 
 
 
 
 --
  Nokia and ATT present the 2010 Calling All Innovators-North America
 contest
  Create new apps  games for the Nokia N8 for consumers in  U.S. and
 Canada
  $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
 marketing
  Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
  http://p.sf.net/sfu/nokia-dev2dev
 
 
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users



 --
 Nokia and ATT present the 2010 Calling All Innovators-North America
 contest
 Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
 $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
 marketing
 Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
 http://p.sf.net/sfu/nokia-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] range in the colorbar

2010-10-21 Thread Alexander Dietz
Hi,

I am generating a scatter plot with a colorbar, and want to pass on the
colorbar to some function to do something with it, like

plt.scatter(px, py, c=pz, ...)
cb = plt.colorbar()
foo(cb)


My question: How can I extract the range of the colorbar from the cb object?
The colorbar extends from min(pz) to max(pz), but can I access these values
from the cb object alone, without the need to pass pz to foo as well?


Thanks
  Alex
--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] range in the colorbar

2010-10-21 Thread Eric Firing
On 10/20/2010 11:41 PM, Alexander Dietz wrote:
 Hi,

 I am generating a scatter plot with a colorbar, and want to pass on the
 colorbar to some function to do something with it, like

 plt.scatter(px, py, c=pz, ...)
 cb = plt.colorbar()
 foo(cb)


 My question: How can I extract the range of the colorbar from the cb
 object? The colorbar extends from min(pz) to max(pz), but can I access
 these values from the cb object alone, without the need to pass pz to
 foo as well?

cb.norm.vmin
cb.norm.vmax

Or you can get the same thing from the collection returned by scatter:

col = scatter(...)
col.norm.vmin
col.norm.vmax

The colorbar uses the norm and colormap from the current image (or more 
generally, the color-mappable object), which in this case is the 
collection generated by scatter().

Eric



 Thanks
Alex



 --
 Nokia and ATT present the 2010 Calling All Innovators-North America contest
 Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
 $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
 Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
 http://p.sf.net/sfu/nokia-dev2dev



 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users