|
From: Peter J. <pet...@fr...> - 2004-04-20 10:54:59
|
Q: Is it possible to change the default color scale of the matplotlib.matlab.pcolor plot? How? -Peter |
|
From: Wendell C. <wcr...@uf...> - 2004-11-30 13:16:29
|
I have been trying to use pcolor() to display a grid with discrete values (1-4) that are changing over time. I'm generating a series of saved figures that also include a line graph of the sums of the 4 categories. The problem is that that mapping of numbers to colors isn't constant for the pcolor output. I changed the array from Float32 (used out of habit) to integer and got the same type of result. It would also be nice to be able to use the same color mapping for both sub plots. I think (guess) that cmap=cm.jet controls the color scheme, but it isn't clear to me how to change that, what format it has, or why it seems to change with repeated calls to pcolor() inside the program. Thanks, Wendell Cropper University of Florida School of Forest Resources and Conservation 214 Newins-Ziegler PO Box 110410 Gainesville, FL 32611-0410 352-846-0859 phone 352-392-1707 fax wcr...@uf... |
|
From: John H. <jdh...@ac...> - 2004-11-30 21:00:03
|
>>>>> "Wendell" == Wendell Cropper <wcr...@uf...> writes:
Wendell> I have been trying to use pcolor() to display a grid with
Wendell> discrete values (1-4) that are changing over time. I'm
Wendell> generating a series of saved figures that also include a
Wendell> line graph of the sums of the 4 categories. The problem
Wendell> is that that mapping of numbers to colors isn't constant
Wendell> for the pcolor output. I changed the array from Float32
Wendell> (used out of habit) to integer and got the same type of
Wendell> result. It would also be nice to be able to use the same
Wendell> color mapping for both sub plots.
Wendell> I think (guess) that cmap=cm.jet controls the color
Wendell> scheme, but it isn't clear to me how to change that, what
Wendell> format it has, or why it seems to change with repeated
Wendell> calls to pcolor() inside the program.
It sounds to me like the color limits are being autoscaled with each
call to pcolor. cm.jet does define the color map, but the color
limits define the range of your data that correspond to the min and
max of the colormap.
See help(clim)
If after each call to pcolor, you manually set the clim, you should
have no problems.
JDH
Wendell> -------------------------------------------------------
Wendell> SF email is sponsored by - The IT Product Guide Read
Wendell> honest & candid reviews on hundreds of IT Products from
Wendell> real users. Discover which products truly live up to the
Wendell> hype. Start reading now.
Wendell> http://productguide.itmanagersjournal.com/
Wendell> _______________________________________________
Wendell> Matplotlib-users mailing list
Wendell> Mat...@li...
Wendell> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Wendell C. <wcr...@uf...> - 2004-11-30 21:29:24
|
Thanks very much. Setting clim(0.0, 1.0) inside the loop stabilized the color mapping. Wendell Cropper At 02:58 PM 11/30/2004 -0600, John Hunter wrote: >>>>>> "Wendell" == Wendell Cropper <wcr...@uf...> writes: > > Wendell> I have been trying to use pcolor() to display a grid with > Wendell> discrete values (1-4) that are changing over time. I'm > Wendell> generating a series of saved figures that also include a > Wendell> line graph of the sums of the 4 categories. The problem > Wendell> is that that mapping of numbers to colors isn't constant > Wendell> for the pcolor output. I changed the array from Float32 > Wendell> (used out of habit) to integer and got the same type of > Wendell> result. It would also be nice to be able to use the same > Wendell> color mapping for both sub plots. > > Wendell> I think (guess) that cmap=cm.jet controls the color > Wendell> scheme, but it isn't clear to me how to change that, what > Wendell> format it has, or why it seems to change with repeated > Wendell> calls to pcolor() inside the program. > >It sounds to me like the color limits are being autoscaled with each >call to pcolor. cm.jet does define the color map, but the color >limits define the range of your data that correspond to the min and >max of the colormap. > >See help(clim) > >If after each call to pcolor, you manually set the clim, you should >have no problems. > >JDH > > > > Wendell> ------------------------------------------------------- > Wendell> SF email is sponsored by - The IT Product Guide Read > Wendell> honest & candid reviews on hundreds of IT Products from > Wendell> real users. Discover which products truly live up to the > Wendell> hype. Start reading now. > Wendell> http://productguide.itmanagersjournal.com/ > Wendell> _______________________________________________ > Wendell> Matplotlib-users mailing list > Wendell> Mat...@li... > Wendell> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > University of Florida School of Forest Resources and Conservation 214 Newins-Ziegler PO Box 110410 Gainesville, FL 32611-0410 352-846-0859 phone 352-392-1707 fax wcr...@uf... |
|
From: yadin B. R. <con...@ya...> - 2007-10-05 08:55:00
|
I i have tree lists of values=0Alist x of 100... values=0Alist y of 100.. v=
alues=0Alist mag of 100.. values=0Alist x and y are coordiantes of points =
=0Aand list Mag is magnitude of something at that point=0A=0Ahow can i plot=
this quantities using pcolor=0A=0Afrom __future__ import division=0Afrom m=
atplotlib.patches import Patch=0Afrom pylab import *=0A=0Adef func3(x,y):=
=0A return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)=0A=0A=0A# make these s=
maller to increase the resolution=0Adx, dy =3D 0.5, 0.5=0A=0AX =3D arange(-=
3.0, 3.0001, dx)=0A=0AY =3D arange(-3.0, 3.0001, dy)=0A=0AMag=3D X**2+Y**2=
=0A=0Apcolor(X, Y, Mag, shading=3D'flat')=0Acolorbar()=0Aaxis([-3,3,-3,3])=
=0Asavefig('pcolor_demo')=0Ashow()=0A=0A=0A=0A=0A ____________________=
________________________________________________________________=0A=A1S=E9 =
un mejor besador!=0AComparte todo lo que sabes sobre besos. =
=0Ahttp://telemundo.yahoo.com/promos/mejorbesador.html |
|
From: Eric F. <ef...@ha...> - 2007-10-05 17:43:18
|
The short answer to your two messages is that pcolor and contour
required gridded data in 2D arrays, and it looks like you are supplying
1D arrays. Look at the differences between what you have below and what
is in the pcolor_demo that you started with. Meshgrid is generating 2D
arrays for X and Y so that Z is also 2D. There are other ways of doing
it, and for a Cartesian grid, X and Y don't actually have to be
2D--although I find that there is now a bug in svn such that 1D x and y
don't work. I will fix that. But in any case, Z *must* be a 2D array.
If the data you really want to plot are not already on a grid, then you
will need to use a gridding routine, which is not included in mpl.
Eric
yadin Bocuma Rivas wrote:
> I i have tree lists of values
> list x of 100... values
> list y of 100.. values
> list mag of 100.. values
> list x and y are coordiantes of points
> and list Mag is magnitude of something at that point
>
> how can i plot this quantities using pcolor
>
> from __future__ import division
> from matplotlib.patches import Patch
> from pylab import *
>
> def func3(x,y):
> return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
>
>
> # make these smaller to increase the resolution
> dx, dy = 0.5, 0.5
>
> X = arange(-3.0, 3.0001, dx)
>
> Y = arange(-3.0, 3.0001, dy)
>
> Mag= X**2+Y**2
>
> pcolor(X, Y, Mag, shading='flat')
> colorbar()
> axis([-3,3,-3,3])
> savefig('pcolor_demo')
> show()
>
>
> ------------------------------------------------------------------------
>
> ¡Sé un mejor ambientalista!
> Encuentra consejos para cuidar el lugar donde vivimos en:
> http://telemundo.yahoo.com/promos/mejorambientalista.html
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Bryan F. <bry...@gm...> - 2007-11-20 03:37:22
|
I would like to use pcolor with the colors going from white (zero values) to black (largest value). I am using, pcolor(a, shading =3D 'flat') colorbar() I do not see how to do this. --=20 "The game of science can accurately be described as a never-ending insult to human intelligence."=09- Jo=E3o Magueijo |
|
From: Jeff W. <js...@fa...> - 2007-11-20 04:08:13
|
Bryan Fodness wrote: > I would like to use pcolor with the colors going from white (zero > values) to black (largest value). > > I am using, > > pcolor(a, shading = 'flat') > colorbar() > > I do not see how to do this. > > > pcolor(a, shading = 'flat', cmap=cm.binary) -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
|
From: John H. <jd...@gm...> - 2007-11-20 14:21:12
|
On Nov 19, 2007 10:08 PM, Jeff Whitaker <js...@fa...> wrote: > Bryan Fodness wrote: > > I would like to use pcolor with the colors going from white (zero > > values) to black (largest value). > pcolor(a, shading = 'flat', cmap=cm.binary) It may not be a binary map you want (that has just two colors) but a reversed grayscale map which is continuous from white to black, in which case you would use cmap=cm.gray_r JDH |
|
From: Eric F. <ef...@ha...> - 2007-11-20 17:15:52
|
John Hunter wrote: > On Nov 19, 2007 10:08 PM, Jeff Whitaker <js...@fa...> wrote: >> Bryan Fodness wrote: >>> I would like to use pcolor with the colors going from white (zero >>> values) to black (largest value). > >> pcolor(a, shading = 'flat', cmap=cm.binary) > > It may not be a binary map you want (that has just two colors) but a > reversed grayscale map which is continuous from white to black, in > which case you would use cmap=cm.gray_r Agreed, logically it should be cm.gray_r. But, surprisingly, cm.binary looks identical. Maybe cm.binary is not doing what you intended it to do? (I have always found LinearSegmentedColormap hard to understand, in spite of what seems to be abundant explanation in the docstrings.) Eric |
|
From: sanGuziy <guz...@gm...> - 2011-04-02 00:42:06
|
Dear list,
I have a question concerning pcolor.
I am trying to plot a huge 2d array 15000x10000.
And in top I see that the program already uses 31Gb of ram and it grows.
Is this expected behaviour?
Why it needs so much memory?
the sctipt is simple:
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import rand
import mpl_toolkits.basemap as bm
if __name__ == "__main__":
print matplotlib.__version__
print matplotlib.__revision__
print matplotlib.__date__
print 'basemap'
print bm.__version__
print 'numpy'
print np.__version__
x = rand(15000,10000)
#print x
plt.pcolor(x)
plt.savefig('test_pcolor.png', bbox_inches = 'tight')
print "Hello World"
matplotlib version is:
1.0.0
$Revision: 8503 $
$Date: 2010-07-06 08:56:31 -0500 (Tue, 06 Jul 2010) $
should I update?
thank you for any help
--
Oleksandr Huziy
--
View this message in context: http://old.nabble.com/pcolor-tp31300362p31300362.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Oleksandr H. <guz...@gm...> - 2011-04-02 00:57:09
|
Ok, it works ok with pcolormesh, sorry for bothering you.
--
Oleeksandr
2011/4/1 sanGuziy <guz...@gm...>
>
> Dear list,
>
> I have a question concerning pcolor.
> I am trying to plot a huge 2d array 15000x10000.
> And in top I see that the program already uses 31Gb of ram and it grows.
> Is this expected behaviour?
> Why it needs so much memory?
> the sctipt is simple:
>
> import matplotlib
> import numpy as np
> import matplotlib.pyplot as plt
>
> from numpy.random import rand
>
> import mpl_toolkits.basemap as bm
>
>
> if __name__ == "__main__":
>
> print matplotlib.__version__
> print matplotlib.__revision__
> print matplotlib.__date__
>
>
> print 'basemap'
> print bm.__version__
>
> print 'numpy'
> print np.__version__
>
>
> x = rand(15000,10000)
> #print x
> plt.pcolor(x)
> plt.savefig('test_pcolor.png', bbox_inches = 'tight')
> print "Hello World"
>
> matplotlib version is:
> 1.0.0
> $Revision: 8503 $
> $Date: 2010-07-06 08:56:31 -0500 (Tue, 06 Jul 2010) $
>
> should I update?
>
> thank you for any help
> --
> Oleksandr Huziy
> --
> View this message in context:
> http://old.nabble.com/pcolor-tp31300362p31300362.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: John H. <jdh...@ac...> - 2004-04-20 11:58:41
|
>>>>> "Peter" == Peter Juvan <pet...@fr...> writes:
Peter> Q: Is it possible to change the default color scale of the
Peter> matplotlib.matlab.pcolor plot? How? -Peter
You can define your own colormap by subclassing
matplotlib.colors.Colormap and then passing this to imshow in the cmap
argument. Note that for the most part pcolor and imshow have the same
functionality, but imshow is 1000 times faster for large grids.
Compare pcolor_demo.py and pcolor_demo2.py in the examples dir which
use pcolor and imshow respectively. Note, if you really need the
functionality of pcolor over imshow (eg you want to set some
properties on the rectangle patches), I can modify the pcolor argument
list to use your custom colormap.
If you define a new colormap (currently we have only jet and
grayscale), please send it back to the list so I can include it.
JDH
|
|
From: Peter J. <pet...@fr...> - 2004-04-20 13:21:25
|
> From: John Hunter [mailto:jdh...@ac...] > > Note, if you really need the > functionality of pcolor over imshow (eg you want to set some > properties on the rectangle patches), I can modify the pcolor argument > list to use your custom colormap. I prefer pcolor over imshow - I need to represent values from a 12x12 matrix as colors. Please modify pcolor arguments to use a custom colormap. Where / when will I be able to obtain the modified version? -Peter |
|
From: John H. <jdh...@ac...> - 2004-04-20 13:29:39
|
>>>>> "Peter" == Peter Juvan <pet...@fr...> writes:
Peter> I prefer pcolor over imshow - I need to represent values
Peter> from a 12x12 matrix as colors. Please modify pcolor
Peter> arguments to use a custom colormap. Where / when will I be
Peter> able to obtain the modified version? -Peter
For 12x12 pcolor should work great. I included the pcolor cmap kwarg
for the next release, which is starting to look like tomorrow rather
than today .....
JDH
|