From: <seb...@sp...> - 2004-12-13 06:14:15
|
The z-axis values that I want to denote with color on this plot range from something like 57000 to 66000. I think I somehow need to tell Matplotlib what these minimum and maximum values are so that my color spectrum can range over desired colors for my specific plotting range. How do this? (How make 57000 be one color extreme and make 66000 be my other color extreme?) Chris -- _______________________________________ Christian Seberino, Ph.D. SPAWAR Systems Center San Diego Code 2872 49258 Mills Street, Room 158 San Diego, CA 92152-5385 U.S.A. Phone: (619) 553-9973 Fax : (619) 553-6521 Email: seb...@sp... _______________________________________ |
From: Steve C. <ste...@ya...> - 2004-12-13 09:38:11
|
On Sun, 2004-12-12 at 22:14 -0800, seb...@sp... wrote: > The z-axis values that I want to denote with color on this > plot range from something like 57000 to 66000. > > I think I somehow need to tell Matplotlib what these minimum > and maximum values are so that my color spectrum can range over > desired colors for my specific plotting range. > > How do this? (How make 57000 be one color extreme and make > 66000 be my other color extreme?) > > Chris By normalising 57000 to 0 and 66000 to 1 and using a custom colormap function to generate rgb values to feed into matplotlib. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52273 I was looking at this cookbook recipe yesterday, it looks like it does what you require. Steve |
From: John H. <jdh...@ac...> - 2004-12-13 15:26:20
|
>>>>> "seberino" == seberino <seb...@sp...> writes: seberino> The z-axis values that I want to denote with color on seberino> this plot range from something like 57000 to 66000. seberino> I think I somehow need to tell Matplotlib what these seberino> minimum and maximum values are so that my color spectrum seberino> can range over desired colors for my specific plotting seberino> range. seberino> How do this? (How make 57000 be one color extreme and seberino> make 66000 be my other color extreme?) What plotting function are you using, imshow, pcolor, scatter, etc? The matplotlib color mapping and scaling will handle this automatically. It assigns 57000 to the first color on your colormap and 66000 to the last color, with interpolation between. There are a variety of ways to customize this # vmin is 57000 but vmax is changed >>> imshow(X, vmax=70000) # vmin is 66000 but vmin is changed >>> imshow(X, vmin=50000) # vmin and vmax both customized >>> imshow(X, vmax=50000, vmax=70000) Once you've plotted your data, you can use the clim function to set the color limits >>> clim(55000, 60000) Should help, JDH |
From: <seb...@sp...> - 2004-12-13 17:04:01
|
I'm using pcolor. All z values looked the same color. It may be a my fault (my bug) if you say colors should be different. I'll try your customizations too. Does clim work with pcolor? CS On Mon, Dec 13, 2004 at 09:23:51AM -0600, John Hunter wrote: > >>>>> "seberino" == seberino <seb...@sp...> writes: > > seberino> The z-axis values that I want to denote with color on > seberino> this plot range from something like 57000 to 66000. > > seberino> I think I somehow need to tell Matplotlib what these > seberino> minimum and maximum values are so that my color spectrum > seberino> can range over desired colors for my specific plotting > seberino> range. > > seberino> How do this? (How make 57000 be one color extreme and > seberino> make 66000 be my other color extreme?) > > What plotting function are you using, imshow, pcolor, scatter, etc? > The matplotlib color mapping and scaling will handle this > automatically. It assigns 57000 to the first color on your colormap > and 66000 to the last color, with interpolation between. There are a > variety of ways to customize this > > # vmin is 57000 but vmax is changed > >>> imshow(X, vmax=70000) > > # vmin is 66000 but vmin is changed > >>> imshow(X, vmin=50000) > > > # vmin and vmax both customized > >>> imshow(X, vmax=50000, vmax=70000) > > Once you've plotted your data, you can use the clim function to set > the color limits > > >>> clim(55000, 60000) > > Should help, > JDH > -- _______________________________________ Christian Seberino, Ph.D. SPAWAR Systems Center San Diego Code 2872 49258 Mills Street, Room 158 San Diego, CA 92152-5385 U.S.A. Phone: (619) 553-9973 Fax : (619) 553-6521 Email: seb...@sp... _______________________________________ |
From: John H. <jdh...@ac...> - 2004-12-13 17:44:48
|
>>>>> "seberino" == seberino <seb...@sp...> writes: seberino> I'm using pcolor. All z values looked the same color. seberino> It may be a my fault (my bug) if you say colors should seberino> be different. I'll try your customizations too. seberino> Does clim work with pcolor? There may be a problem with colormapping/clim in 0.64, but these are all fixed in the next release of matplotlib, due out today. I just tested 1 >>> Z = rand(10,10)*20000 + 40000 2 >>> pcolor(Z) Out[2]: <matplotlib.collections.PolyCollection instance at 0x41d3cf4c> 3 >>> colorbar ----> colorbar() Out[3]: <matplotlib.axes.Axes instance at 0x41d3624c> 4 >>> clim(30000,80000) and everything worked as expected. JDH |