SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(2)
2
(5)
3
(8)
4
(6)
5
(9)
6
(7)
7
(6)
8
(10)
9
(27)
10
(7)
11
(22)
12
(13)
13
(7)
14
(4)
15
(12)
16
(32)
17
(26)
18
(14)
19
(1)
20
(11)
21
(6)
22
(11)
23
(17)
24
(18)
25
(28)
26
(11)
27
(6)
28
(1)
29
(10)
30
(12)




Showing 10 results of 10

From: Jose Gomez-D. <jgo...@gm...> - 2008年09月08日 23:52:21
Jeff,
On Mon, Sep 8, 2008 at 6:48 PM, Jeff Whitaker <js...@fa...> wrote:
> Note that to plot the data with pcolor/pcolormesh of contourf, you don't
> need to interpolate to a native projection grid. You can just do
>
> lons, lats = np.meshgrid(lons,lats)
> x,y = m(lons,lats)
> im = m.pcolormesh(x,y,datain)
OK, I've gone down the pcolormesh route. Results is very nice. However, if I
try to save my file as an EPS or PDF, it takes a long time, and the
resulting PDF is 12Mb (!). The equivalent EPS is of the order of 500MB
(!!!!), and the PNG is around 100kb (!!!!!). I have a really hard time
rendering either the EPS or the PDF, and I guess that using pcolormesh
somehow sticks all the pixels into the resulting "page". My image size is
around 1000x2500 pixels, and I'm not particularly bothered if it is smoothed
for "presentation purposes" (in fact, I think I can see some aliasing, but
don't have the plot in front of me right now).
I don't recall this problem when using imshow (no basemap involved). Is this
a pcolormesh "feature" (or converseley, an imshow feature?). Is there some I
can make my plots be as reasonable as other MPL plots that are mostly
vectors rather than rasters?
Cheers,
J
-- 
Centre for Terrestrial Carbon Dynamics
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
From: Bernardo M. R. <ber...@me...> - 2008年09月08日 21:32:17
Hi Guys,
how can I set the size of a plot window by, let's say, 320 x 180 and make it fix, that is, something like "resize=False". I had a look at the documentation but I couldn't figure out which object and method I have to use for this.
Thanks in advance!
Bernardo M. Rocha
From: Marjolaine R. <mro...@cs...> - 2008年09月08日 19:31:45
Hi all,
Michael's solution worked like a charm. Thanks to all for your valuable input!
Rgs.
>>> Michael Droettboom <md...@st...> 09/05/08 7:54 PM >>>
You could do something like:
def bitget(value, bit_number):
 return (value & (1 << bit_number)) != 0
which will return True or False for the given bit number, and this 
function works on numpy arrays. (Bits are numbered base-0 -- I don't 
know if that matches matlab).
Hope that helps,
Mike
Marjolaine Rouault wrote:
> Hi,
>
> I was wondering if python has the equivalent of the matlab bitget.m function.
>
> I have a large 2 dimensional variable of type uint32 which I must convert to binaries and then find if bit 23 of the binary for each point is 0 or 1. The matlab bitget function is ideal for that but I can't find much in python. The only thing I found was binary_repr which converts to a sting and can only be used for 1 point at a time.
>
> Any suggestions?
>
> Thanks, Marjolaine.
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
From: Jose Gómez-D. <jgo...@gm...> - 2008年09月08日 18:12:25
Hi!
About a year ago, Jouni Seppänen indicated how to put a number of patches in a 
legend. So far so good. Now, it turns out that I do have quite a lot of 
patches to throw into this legend, and it would be nice, rather than to have 
a single column, to have the possibility to arrange these patches (and 
associated labels) into columns. I have looked at the legend object, but 
there is nothing suggesting that things can be shuffled around within the 
legend box itself, some sort of "subplot()" for the legend patches. Am I 
correct in assuming this doesn't exist (yet!). I am running 0.91.2, maybe 
it's already been implemented, but I thought I'd ask!
Cheers!
J
-- 
NERC Centre for Terrestrial Carbon Dynamics,
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
From: Jeff W. <js...@fa...> - 2008年09月08日 17:48:27
Jose Gómez-Dans wrote:
> Hi,
> I am starting to play with Basemap. I have some raster data in 
> longitude/latitude (WGS-84, EPSG: 4326). I would like to plot it using 
> imshow, and to then plot some country boundaries and so on and so forth. I 
> have studied the plotprecip.py example in Basemap's distribution, but as far 
> as i can tell, there's no reprojection of the data there (i.e., the data is 
> already in whatever projection Basemap was initiated with). While I can 
> reproject the data outside of MPL, I was wondering whether I'm missing 
> something, and I can just reproject my data and call imshow within my python 
> script.
>
> Cheers,
> J
>
>
>
> 
Jose: If you data is on a lat/lon grid, you can plot it directly with 
Basemap with projection='cyl'. If you want to plot it on some other 
projection, you can reproject the data with Basemap quite easily. The 
test.py script in the examples directory shows how to reproject lat/lon 
data and plot with imshow for each of the map projections Basemap 
supports.
The basic recipe is this:
import numpy as np
import matplotlib.pyplot as plt
# transform to nx x ny regularly spaced 40km native projection grid
nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
# datain is input data on lat/lon grid described by 1d arrays lons, lats
# (longitudes and latitudes in degrees).
topodat = m.transform_scalar(datain,lons,lats,nx,ny)
# plot image over map with imshow. m is a Basemap instance defining the 
projection
# you want to plot on.
im = m.imshow(topodat,plt.cm.jet)
Note that to plot the data with pcolor/pcolormesh of contourf, you don't 
need to interpolate to a native projection grid. You can just do
lons, lats = np.meshgrid(lons,lats)
x,y = m(lons,lats)
im = m.pcolormesh(x,y,datain)
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Evan M. <eva...@gm...> - 2008年09月08日 17:36:18
Hi, wonder if anyone can help me with path and bbox. I have a set of ocean
drifter tracks and I want to know if they pass through a particular boxed
area. This is straightforward to do but I wanted to try to do it with
matplotlib.transforms and matplotlib.path, which look well-suited to this
kind of task using 'intersects_bbox'.
The essence of my code is below. I have a single drifter track (lon, lat)
and have defined a boxed area. At no time does the drifter approach or
enter the box - however, the final line,
 print track.intersects_bbox(bbox)
returns True, which it shouldn't. In total I have 340 tracks. My code says
74 pass though the box, but by counting there should be only about 9. Any
help appreciated, thanks, Evan
import numpy as N
import numpy.ma as MA
import matplotlib.transforms as BB
import matplotlib.path as PP
In [200]: lon
Out[200]:
masked_array(data = [-15.52 -15.521 -15.541 ..., -- -- --],
 mask = [False False False ..., True True True],
 fill_value=1e+20)
In [201]: lat
Out[201]:
masked_array(data = [29.2 29.2 29.196 ..., -- -- --],
 mask = [False False False ..., True True True],
 fill_value=1e+20)
In [202]: len(lon), len(lat)
Out[202]: (3750, 3750)
track = MA.transpose([lon, lat])
track = PP.Path(track)
bbox = BB.Bbox.from_extents(-15.95, 29.6, -15.9, 29.65)
In [206]: print track.intersects_bbox(bbox)
1
From: Jose Gómez-D. <jgo...@gm...> - 2008年09月08日 17:27:10
Hi,
I am starting to play with Basemap. I have some raster data in 
longitude/latitude (WGS-84, EPSG: 4326). I would like to plot it using 
imshow, and to then plot some country boundaries and so on and so forth. I 
have studied the plotprecip.py example in Basemap's distribution, but as far 
as i can tell, there's no reprojection of the data there (i.e., the data is 
already in whatever projection Basemap was initiated with). While I can 
reproject the data outside of MPL, I was wondering whether I'm missing 
something, and I can just reproject my data and call imshow within my python 
script.
Cheers,
J
-- 
NERC Centre for Terrestrial Carbon Dynamics,
Department of Geography, University College London
Gower Street, London WC1E 6BT, UK
From: Antonino C. <cuc...@as...> - 2008年09月08日 07:57:28
Yes, I did indeed.
Is it sufficient replace the matplotlib directory under the scisoft/ 
with the one available from the site (0.98.0) to update it?
I also noticed that the available Fink package is also the 
matplotlib-0.91.0.
Thanks,
Nino
Manuel Metz wrote:
> Antonino Cucchiara wrote:
> 
>> Hello list,
>> I am trying to run the "histogram_demo_extended.py" on my mac 10.5.
>> I installed matplotlib through the scisoft package.
>> The normal hist command works fine but when I tried to use "align" or 
>> "histtype" keyward I get this kind of error:
>>
>> [Macintosh-2:~/optional/examples/pylab_examples] nino% 
>> ./histogram_demo_extended.py 
>> Traceback (most recent call last):
>> File "./histogram_demo_extended.py", line 15, in <module>
>> n, bins, patches = P.hist(x, 50, normed=1, histtype='stepfilled')
>> File 
>> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/pyplot.py", 
>> line 1633, in hist
>> ret = gca().hist(*args, **kwargs)
>> File 
>> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", 
>> line 5064, in hist
>> p.update(kwargs)
>> File 
>> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/artist.py", 
>> line 394, in update
>> raise AttributeError('Unknown property %s'%k)
>> AttributeError: Unknown property histtype
>>
>> Can someone give me any advice?
>> Thanks a lot in advance.
>>
>> nino
>>
>> 
>
> I guess that you installed matplotlib v0.91.x via scisoft !? The keyword 
> "histtype" was introduced in 0.98.0, so you can't use it on your system.
>
> Manuel
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Antonino Cucchiara
PhD candidate
Department of Astronomy&Astrophysics
Penn State University
website: www.astro.psu.edu/~cucchiara/
From: Manuel M. <mm...@as...> - 2008年09月08日 07:37:32
Antonino Cucchiara wrote:
> Hello list,
> I am trying to run the "histogram_demo_extended.py" on my mac 10.5.
> I installed matplotlib through the scisoft package.
> The normal hist command works fine but when I tried to use "align" or 
> "histtype" keyward I get this kind of error:
> 
> [Macintosh-2:~/optional/examples/pylab_examples] nino% 
> ./histogram_demo_extended.py 
> Traceback (most recent call last):
> File "./histogram_demo_extended.py", line 15, in <module>
> n, bins, patches = P.hist(x, 50, normed=1, histtype='stepfilled')
> File 
> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/pyplot.py", 
> line 1633, in hist
> ret = gca().hist(*args, **kwargs)
> File 
> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", 
> line 5064, in hist
> p.update(kwargs)
> File 
> "/scisoft/i386/library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/artist.py", 
> line 394, in update
> raise AttributeError('Unknown property %s'%k)
> AttributeError: Unknown property histtype
> 
> Can someone give me any advice?
> Thanks a lot in advance.
> 
> nino
> 
I guess that you installed matplotlib v0.91.x via scisoft !? The keyword 
"histtype" was introduced in 0.98.0, so you can't use it on your system.
Manuel
From: Johann Cohen-T. <co...@sl...> - 2008年09月08日 07:18:51
thanks Johan,
I posted to scipy because of histogram2d being in numpy, sorry about that.
Now the stupid question, why can't imshow directly parse histogram2d, 
without the transitory extent object?
Anyway, I am happy that there is a simple way as explained below!
thanks again,
Johann
John Hunter wrote:
> On Fri, Sep 5, 2008 at 10:36 AM, Johann Cohen-Tanugi
> <co...@sl...> wrote:
> 
>> hi, I hope someone can quickly point me to some doc.
>> I can do imshow(histogram2d(x,y)[0]) but then I miss the x and y binning
>> correct labels.
>> If I do imshow(histogram2d(x,y)) I get:
>> ERROR: An unexpected error occurred while tokenizing input
>> The following traceback may be corrupted or invalid
>> The error message is: ('EOF in multi-line statement', (115, 0))
>> 
>
> matplotlib questions are best addressed to the matplotlib-users mailing list at
>
> http://lists.sourceforge.net/mailman/listinfo/matplotlib-users
>
> histogram2d returns H, xedges and yedges. The first argument should
> be passed to imshow, and the second two can be used to get the extents
>
> In [26]: x, y = np.random.randn(2, 100000)
>
> In [27]: H, xedges, yedges = np.histogram2d(x, y, bins=50)
>
> In [28]: extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
>
> In [29]: imshow(H, extent=extent)
> Out[29]: <matplotlib.image.AxesImage object at 0x9377bcc>
>
> I
> _______________________________________________
> SciPy-user mailing list
> Sci...@sc...
> http://projects.scipy.org/mailman/listinfo/scipy-user
> 

Showing 10 results of 10

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /