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
(1)
2
(12)
3
(12)
4
(19)
5
(7)
6
(6)
7
(2)
8
(2)
9
(11)
10
(15)
11
(27)
12
(27)
13
(18)
14
(3)
15
(3)
16
(25)
17
(9)
18
(3)
19
(4)
20
(2)
21
(4)
22
(9)
23
(28)
24
(18)
25
(16)
26
(9)
27
(4)
28
(13)
29
(15)
30
(33)





Showing results of 346

<< < 1 .. 12 13 14 (Page 14 of 14)
From: <PH...@Ge...> - 2009年11月03日 18:12:09
Hey everyone,
The existence of the matplotlibrc file is one reason I like MPL so much. I won't go into the convoluted work flow I had for getting my MATLAB figures completely processed in TeX, but it was nasty. 
On my Windows machine, I've used it with great success. But I can't get my Mac (OS 10.5) to see it at all. I've put it in my current working directory, in /Library/Frameworks/.../mpl_data, and in /Users/paul. I've confirmed that those directories are in my sys.path variable as well. Nothing seems to work.
Mac OS 10.5
Python 2.6.2
MPL 0.99.1
Any advice?
Thanks,
Paul M. Hobson 
Senior Staff Engineer
-- 
Geosyntec Consultants 
55 SW Yamhill St, Ste 200
Portland, OR 97204
Phone: (503) 222-9518
Web: www.geosyntec.com
From: Jeff W. <js...@fa...> - 2009年11月03日 13:19:48
Gary Ruben wrote:
> I'm plotting a coverage map of a sphere using the Mollweide plot in
> basemap. The attachment is an example that is produced by sending an
> array of polygons (one polygon per row described as four corners, one
> per column) described using polar (theta) and azimuthal (phi) angles to
> the following function. As a kludge, I discard any polygons that cross
> the map boundary, but this produces artefacts and it would be better to
> subdivide these and keep the parts. I was wondering whether there's a
> function I missed that allows me to add polygons and performs the split
> across the map boundary.
>
> Gary R.
Gary: You might be able to use the _geoslib module to compute the 
intersections of those polygons with the map boundary. I do a similar 
thing with the coastline polygons in the _readboundarydata function. 
The _boundarypolyll and _boundarypolyxy instance variables have the 
vertices of the map projection region polygons in lat/lon and projection 
coords. You could do somethig like this:
 from mpl_toolkits.basemap import _geoslib
 poly = _geoslib.Polygon(b) # a geos Polygon instance 
describing your polygon)
 b = self._boundarypolyxy.boundary
 bx = b[:,0]; by= b[:,1]
 boundarypoly = _geoslib.Polygon(b) # a geos Polygon instance 
describing the map region
 if poly.intersects(boundarypoly):
 geoms = poly.intersection(boundarypoly)
 polygons = [] # polygon intersections to plot.
 for psub in geoms:
 b = psub.boundary # boundary of an intersection
 polygons.append(zip(b[:,0],b[:,1]))
-Jeff
>
> def Mollweide(theta, phi):
> def combinations(iterable, r):
> ''' Python 2.6 itertools function'''
> # combinations('ABCD', 2) --> AB AC AD BC BD CD
> # combinations(range(4), 3) --> 012 013 023 123
> pool = tuple(iterable)
> n = len(pool)
> if r > n:
> return
> indices = range(r)
> yield tuple(pool[i] for i in indices)
> while True:
> for i in reversed(range(r)):
> if indices[i] != i + n - r:
> break
> else:
> return
> indices[i] += 1
> for j in range(i+1, r):
> indices[j] = indices[j-1] + 1
> yield tuple(pool[i] for i in indices)
>
>
> def boundary_crossed(pts):
> crossed = False
> for c in combinations(pts, 2):
> if abs(c[0]-c[1])>180:
> crossed = True
> break
> return crossed
>
> # Make Mollweide plot
> m = Basemap(projection='moll', lon_0=0, resolution='c')
>
> # draw the edge of the map projection region (the projection limb)
> m.drawmapboundary()
> # draw lat/lon grid lines every 30 degrees.
> m.drawmeridians(np.arange(0,360,30), dashes=[10,0])
> m.drawparallels(np.arange(-90,90,30), dashes=[10,0])
>
> ax = plt.gca() # get current axes instance
> for i in range(theta.shape[0]):
> pts = np.vstack((theta[i], phi[i])).T
> if boundary_crossed(pts[:,1]):
> continue # skip polys that cross the map boundary
>
> polypts = [m(pt[1], pt[0]) for pt in pts]
> poly = Polygon(polypts, facecolor="b", edgecolor="None",
> alpha=0.5)
> ax.add_patch(poly)
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Gary R. <gr...@bi...> - 2009年11月03日 11:46:43
Attachments: 1.png
I'm plotting a coverage map of a sphere using the Mollweide plot in
basemap. The attachment is an example that is produced by sending an
array of polygons (one polygon per row described as four corners, one
per column) described using polar (theta) and azimuthal (phi) angles to
the following function. As a kludge, I discard any polygons that cross
the map boundary, but this produces artefacts and it would be better to
subdivide these and keep the parts. I was wondering whether there's a
function I missed that allows me to add polygons and performs the split
across the map boundary.
Gary R.
def Mollweide(theta, phi):
 def combinations(iterable, r):
 ''' Python 2.6 itertools function'''
 # combinations('ABCD', 2) --> AB AC AD BC BD CD
 # combinations(range(4), 3) --> 012 013 023 123
 pool = tuple(iterable)
 n = len(pool)
 if r > n:
 return
 indices = range(r)
 yield tuple(pool[i] for i in indices)
 while True:
 for i in reversed(range(r)):
 if indices[i] != i + n - r:
 break
 else:
 return
 indices[i] += 1
 for j in range(i+1, r):
 indices[j] = indices[j-1] + 1
 yield tuple(pool[i] for i in indices)
 def boundary_crossed(pts):
 crossed = False
 for c in combinations(pts, 2):
 if abs(c[0]-c[1])>180:
 crossed = True
 break
 return crossed
 # Make Mollweide plot
 m = Basemap(projection='moll', lon_0=0, resolution='c')
 # draw the edge of the map projection region (the projection limb)
 m.drawmapboundary()
 # draw lat/lon grid lines every 30 degrees.
 m.drawmeridians(np.arange(0,360,30), dashes=[10,0])
 m.drawparallels(np.arange(-90,90,30), dashes=[10,0])
 ax = plt.gca() # get current axes instance
 for i in range(theta.shape[0]):
 pts = np.vstack((theta[i], phi[i])).T
 if boundary_crossed(pts[:,1]):
 continue # skip polys that cross the map boundary
 polypts = [m(pt[1], pt[0]) for pt in pts]
 poly = Polygon(polypts, facecolor="b", edgecolor="None",
 alpha=0.5)
 ax.add_patch(poly)
From: Jae-Joon L. <lee...@gm...> - 2009年11月03日 06:26:08
Attachments: cone_test.png
Unfortunately, I don't think something like cone plots can be easily
done with current matplotlib.
I guess you can define custom projection and such, as in the example below
http://matplotlib.sourceforge.net/examples/api/custom_projection_example.html
but this will involve some (maybe a lot) coding + some knowledge of
mpl internals.
With the experimental curvelinear coordinate support in axes_grid
toolkit (and with yet-to-be-committed patch), one can draw very basic
cone plot (see the attached). However, the current support is far from
complete. I'm willing to make it better, but I'm afraid that this may
not happen in a near future (likely not in this year).
Of course, you can try to plot everything (axes boundary, ticks,
ticklabels etc.) manually if you want, and maybe this is the best way
currently available.
Regards,
-JJ
On Sat, Oct 31, 2009 at 4:15 AM, ifriad <if...@gm...> wrote:
>
> Hi,
> Does any one knows how to do those cone plots,
>
> I am attaching a sample plot.
>
> Thanks Ihab
> http://old.nabble.com/file/p26140834/cone.png cone.png
> --
> View this message in context: http://old.nabble.com/cone-plots-tp26140834p26140834.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2009年11月03日 05:52:07
On Mon, Nov 2, 2009 at 10:52 PM, David Sanders <dps...@gm...> wrote:
> from pylab import *
>
> ion()
>
> N = 1000
> pos = zeros((N,2))
>
> figure(figsize=(8,8))
> points, = plot(pos[:,0], pos[:,1], ',')
> axis([-20,20,-20,20])
>
> for t in range(1000):
>
>   pos += uniform(-1,1,N*2).reshape(N,2)
>   points.set_data(pos[:,0].copy(), pos[:,1].copy())
>   draw()
The Line2D object keeps the input data as a cache and only update it
(recache) if the new data is different than the cached one.
The problem in this particular case is that the cache is actually a
*pos* itself. And modifying the pos in place, actually modify the
cache in the Line2D object. Thus, set_data sees that the given data is
identical to the cached one, and skip the recaching.
I'm not sure what is the best approach here, and I defer the fix (or
not) to others.
Meanwhile, you can force the recaching with recache method. i.e., call
points.recache() after set_data. You don't need to make a copy also.
As a matter of fact, I think it will give you a best performance (but
not tested) if you directly update the cached data and do not call
set_data.
Note that in this particular case, pos == cache, so you actually don't
need to call get_data, but this is not a general case.
posx, posy = points.get_data(orig=True)
for t in range(100):
 dx, dy = uniform(-1,1,N*2).reshape(2, N) # note the change in the shape
 posx += dx
 posy += dy
 points.recache()
 draw()
Regards,
-JJ
From: David S. <dps...@gm...> - 2009年11月03日 03:52:50
Hi,
I have a problem with draw() to do simple animations of the contents of
arrays in matplotlib.
I was trying to use the idea in the animations cookbook (
http://www.scipy.org/Cookbook/Matplotlib/Animations)
to animate some "random walkers", but found that the animation did not work.
A minimal example of the problem is given by changing the first recipe in
the cookbook to just draw random arrays.
This version correctly animates as expected:
from pylab import *
import time
ion()
tstart = time.time() # for profiling
x = rand(100)
y = rand(100)
line, = plot(x,y, ',')
for i in arange(1,200):
 x = rand(100)
 y = rand(100)
 line.set_data(x,y)
 draw() # redraw the canvas
Now, however, changing the "x =" and "y =" lines as follows:
 x[:] = rand(100)
 y[:] = rand(100)
so that they are modified in place, rather than creating new arrays, no
longer animates anything.
I am using version 0.99 on linux (Kubuntu 9.10).
The same behaviour is found from within ipython -pylab or from the command
line with python.
In my real application, I wish to use this as a simple way to animate a
collection of random walkers.
I thus have an array of positions which is updated at every step, and this
is what I want to animate,
which is the reason why I tried the array updating step above.
So far, my code is as follows:
from pylab import *
ion()
N = 1000
pos = zeros((N,2))
figure(figsize=(8,8))
points, = plot(pos[:,0], pos[:,1], ',')
axis([-20,20,-20,20])
for t in range(1000):
 pos += uniform(-1,1,N*2).reshape(N,2)
 points.set_data(pos[:,0].copy(), pos[:,1].copy())
 draw()
The ".copy()" are an attempt at creating new arrays. Nonetheless, there is
no animation.
And if I put
points._x
in ipython, then it still has all zeros! Apparently the .set_data() hasn't
done anything.
Any help at getting this animation to work are greatly appreciated!
Thanks and best wishes,
David.
From: Christopher B. <Chr...@no...> - 2009年11月03日 02:35:06
Does the egg at:
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/
matplotlib-0.99.1.1-py2.5-macosx-10.3-i386.egg
not work for you? the 10.3 means "10.3 or greater", and I'm pretty sure 
it is Universal, rather than just i386 as well. It should work with the 
python.org Python 2.5
there is:
matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg
for Python 2.6
I haven't had to compiled MPL is a good while.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: R. M. <rm...@uc...> - 2009年11月03日 00:39:24
Hello All
 I did everything as Pierre suggested. But after using setup.py 
this is what I am getting
"error: command 'gcc-4.0' failed with exit status 1"
Anyone familiar with this bug
On Nov 2, 2009, at 12:42 PM, Pierre de Buyl wrote:
> Hello,
>
>
>> There are multiple versions still existing on my computer. How can I
>> clean up and install the latest version? Thank you all so much
> You need to check the different paths accessed by Python.
> >>> import sys
> >>> print sys.path
> and remove the possible matplotib files in these paths. Typically, 
> this includes /usr/lib/python2.6/site-packages, /usr/local/ 
> lib/..., /opt/lib/..., /sw/lib/... (on mac)
>
> Then, download the .tar.gz file from matplotlib website, uncompress 
> and in the folder run
> $ python setup.py build
>
> That command will check dependencies before building, indicating 
> what is needed.
>
> If some dependencies are not met, I suggest to use a package 
> manager to install them. I use Fink on OS 10.4.11 with no problem, 
> but I am still at Python 2.5 running matplotlib 1.0.svn .
>
> Pierre
>
>
> Le 2 nov. 09 à 20:11, R. Mitra a écrit :
>
>> Hello Again
>> Since I got no replies for my last question and figuring that it
>> must be a problem with numpy (as Eric pointed out) I now have running
>> python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to
>> uninstall previous matplotlib and reinstall it again? This page
>> sounds pretty complicated for me: http://matplotlib.sourceforge.net/
>> users/installing.html#build-osx?
>> Mitra
>>
>> --------------------------------------------------------------------- 
>> ---------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. 
>> Jumpstart your
>> developing skills, take BlackBerry mobile applications to market 
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: William C. <wcc...@lb...> - 2009年11月02日 22:30:27
Hello Mitra,
If you haven't solved your problem yet, I would highly recommend cleaning up
previous versions and using the make.osx file supplied with the matplotlib
download. Edit the PREFIX to replace the example target directory with your
own target directory.
Make sure the MACOSX_DEPLOYMENT_TARGET and the MacOSX versions in the CFLAGS
and LDFLAGS are all set to the version you are using, presumably 10.4.
The make.osx script will check all the required dependencies and go get the
ones it needs for you.
I had a lot of trouble installing matplotlib on 10.6 until I followed this
procedure.
Good luck,
Bill
On 11/2/09 12:11 PM, "R. Mitra" <rm...@uc...> wrote:
> Hello Again
> Since I got no replies for my last question and figuring that it
> must be a problem with numpy (as Eric pointed out) I now have running
> python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to
> uninstall previous matplotlib and reinstall it again? This page
> sounds pretty complicated for me: http://matplotlib.sourceforge.net/
> users/installing.html#build-osx?
> 
> There are multiple versions still existing on my computer. How can I
> clean up and install the latest version? Thank you all so much
> 
> Mitra
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Pierre de B. <pd...@ul...> - 2009年11月02日 21:34:08
 From memory, you just need to make a length one list
contour(z, [i])
Pierre
Le 2 nov. 09 à 22:19, Brendan Arnold a écrit :
> Hi there,
>
> I can draw a single contour line in MATLAB using
>
> contour(z, [i i])
>
> however,
>
> contour(z, [i, i])
>
> using matplotlib gives an error. In fact any plot that plots a single
> line (i.e. contour(z, 1)) also gives an error as follows,
>
> TypeError: unhashable type: 'numpy.ndarray'
>
> How do I draw a single contour line using matplotlib?
>
> regards,
>
> Brendan
>
> ---------------------------------------------------------------------- 
> --------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market 
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2009年11月02日 21:28:10
On Mon, Nov 2, 2009 at 3:19 PM, Brendan Arnold <bre...@gm...> wrote:
> Hi there,
>
> I can draw a single contour line in MATLAB using
>
> contour(z, [i i])
>
> however,
>
> contour(z, [i, i])
>
> using matplotlib gives an error. In fact any plot that plots a single
> line (i.e. contour(z, 1)) also gives an error as follows,
>
> TypeError: unhashable type: 'numpy.ndarray'
>
> How do I draw a single contour line using matplotlib?
I've used:
 ax.contour(R, F, dR, levels=[0])
From: Brendan A. <bre...@gm...> - 2009年11月02日 21:19:46
Hi there,
I can draw a single contour line in MATLAB using
contour(z, [i i])
however,
contour(z, [i, i])
using matplotlib gives an error. In fact any plot that plots a single
line (i.e. contour(z, 1)) also gives an error as follows,
TypeError: unhashable type: 'numpy.ndarray'
How do I draw a single contour line using matplotlib?
regards,
Brendan
From: Pierre de B. <pd...@ul...> - 2009年11月02日 20:43:05
Hello,
> There are multiple versions still existing on my computer. How can I
> clean up and install the latest version? Thank you all so much
You need to check the different paths accessed by Python.
 >>> import sys
 >>> print sys.path
and remove the possible matplotib files in these paths. Typically, 
this includes /usr/lib/python2.6/site-packages, /usr/local/lib/..., / 
opt/lib/..., /sw/lib/... (on mac)
Then, download the .tar.gz file from matplotlib website, uncompress 
and in the folder run
$ python setup.py build
That command will check dependencies before building, indicating what 
is needed.
If some dependencies are not met, I suggest to use a package manager 
to install them. I use Fink on OS 10.4.11 with no problem, but I am 
still at Python 2.5 running matplotlib 1.0.svn .
Pierre
Le 2 nov. 09 à 20:11, R. Mitra a écrit :
> Hello Again
> Since I got no replies for my last question and figuring that it
> must be a problem with numpy (as Eric pointed out) I now have running
> python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to
> uninstall previous matplotlib and reinstall it again? This page
> sounds pretty complicated for me: http://matplotlib.sourceforge.net/
> users/installing.html#build-osx?
> Mitra
>
> ---------------------------------------------------------------------- 
> --------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart 
> your
> developing skills, take BlackBerry mobile applications to market 
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: R. M. <rm...@uc...> - 2009年11月02日 19:16:34
Hello Again
 Since I got no replies for my last question and figuring that it 
must be a problem with numpy (as Eric pointed out) I now have running 
python 2.6.4 and numpy 1.3.0 on OSX 10.4.11. Is there a need to 
uninstall previous matplotlib and reinstall it again? This page 
sounds pretty complicated for me: http://matplotlib.sourceforge.net/ 
users/installing.html#build-osx?
There are multiple versions still existing on my computer. How can I 
clean up and install the latest version? Thank you all so much
Mitra
From: Eric F. <ef...@ha...> - 2009年11月02日 17:56:11
R. Mitra wrote:
> Hello All
> Thanks a lot Eric. I think I have some module missing but I cannot 
> figure out what it is. I get the following. Any idea. This started 
> hapening after I reinstalled matplotlib.
This is a numpy installation or version problem--notice that at the 
bottom of the traceback it is something from numpy that is not being 
found. Installation of numpy and mpl on OSX seems to be subject to all 
sorts of complications, and I don't use OSX, so I will have to leave 
this for someone else on the list.
Eric
> 
> File "/Users/Kennel/Pythoncodes/coolingmodel.py", line 6, in <module>
> import matplotlib
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/__init__.py", 
> line 129, in <module>
> from rcsetup import defaultParams, validate_backend, validate_toolbar
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/rcsetup.py", 
> line 19, in <module>
> from matplotlib.colors import is_color_like
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/colors.py", 
> line 54, in <module>
> import matplotlib.cbook as cbook
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/cbook.py", 
> line 10, in <module>
> import numpy.ma as ma
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/__init__.py", 
> line 47, in <module>
> import extras
> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/extras.py", 
> line 45, in <module>
> from numpy.lib.index_tricks import AxisConcatenator
> ImportError: cannot import name AxisConcatenator
> 
> 
> The first few lines of my codes are:
> 
> from math import *
> import exceptions
> import pmag
> import matplotlib
> matplotlib.use("TkAgg")
> import numpy as np
> import matplotlib.pyplot as plt
> 
> Thanks a lot for all your help.
> 
> Mitra
> 
> 
> On Nov 1, 2009, at 11:32 PM, Eric Firing wrote:
> 
>> R. Mitra wrote:
>>> Hi Eric
>>> from math import *
>>> import matplotlib
>>> matplotlib.use("TkAgg")
>>> from pylab import *
>>> This is very basic I know. The above are the modules I am using. Is 
>>> plt a separate module? Thanks.
>>
>> With your method above, you don't need the "plt." part. "from pylab 
>> import *" is discouraged, however, except for quick interactive use. 
>> For scripts, it is generally considered better practice to use
>>
>> import matplotlib
>> matplotlib.use("tkagg")
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> pyplot is the plot-related part of the pylab namespace; or to put it 
>> another way, pylab is pyplot plus numpy.
>>
>> See http://matplotlib.sourceforge.net/faq/usage_faq.html
>>
>> Eric
>>
>>
>>
>>> RM
>>> On Nov 1, 2009, at 7:26 PM, Eric Firing wrote:
>>>> R. Mitra wrote:
>>>>> Hi
>>>>> I am having problems with contourf(). Suppose I have two 10X30 
>>>>> arrays X,Y and a corresponding Z value array. How do I make the 
>>>>> upper left to be the origin? I cannot use contour 
>>>>> (Z,origin='upper') because the axis values gets messed up.
>>>>
>>>> It sounds like maybe you want to reverse the y-axis. Try something 
>>>> like plt.gca().invert_yaxis() after your call to contourf.
>>>>
>>>> Eric
>>
> 
From: R. M. <rm...@uc...> - 2009年11月02日 17:48:25
Hello All
 Thanks a lot Eric. I think I have some module missing but I 
cannot figure out what it is. I get the following. Any idea. This 
started hapening after I reinstalled matplotlib.
 File "/Users/Kennel/Pythoncodes/coolingmodel.py", line 6, in <module>
 import matplotlib
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/__init__.py", line 129, in <module>
 from rcsetup import defaultParams, validate_backend, 
validate_toolbar
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/rcsetup.py", line 19, in <module>
 from matplotlib.colors import is_color_like
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/colors.py", line 54, in <module>
 import matplotlib.cbook as cbook
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/matplotlib/cbook.py", line 10, in <module>
 import numpy.ma as ma
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/ma/__init__.py", line 47, in <module>
 import extras
 File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/ma/extras.py", line 45, in <module>
 from numpy.lib.index_tricks import AxisConcatenator
ImportError: cannot import name AxisConcatenator
The first few lines of my codes are:
from math import *
import exceptions
import pmag
import matplotlib
matplotlib.use("TkAgg")
import numpy as np
import matplotlib.pyplot as plt
Thanks a lot for all your help.
Mitra
On Nov 1, 2009, at 11:32 PM, Eric Firing wrote:
> R. Mitra wrote:
>> Hi Eric
>> from math import *
>> import matplotlib
>> matplotlib.use("TkAgg")
>> from pylab import *
>> This is very basic I know. The above are the modules I am using. 
>> Is plt a separate module? Thanks.
>
> With your method above, you don't need the "plt." part. "from 
> pylab import *" is discouraged, however, except for quick 
> interactive use. For scripts, it is generally considered better 
> practice to use
>
> import matplotlib
> matplotlib.use("tkagg")
> import numpy as np
> import matplotlib.pyplot as plt
>
> pyplot is the plot-related part of the pylab namespace; or to put 
> it another way, pylab is pyplot plus numpy.
>
> See http://matplotlib.sourceforge.net/faq/usage_faq.html
>
> Eric
>
>
>
>> RM
>> On Nov 1, 2009, at 7:26 PM, Eric Firing wrote:
>>> R. Mitra wrote:
>>>> Hi
>>>> I am having problems with contourf(). Suppose I have two 
>>>> 10X30 arrays X,Y and a corresponding Z value array. How do I 
>>>> make the upper left to be the origin? I cannot use contour 
>>>> (Z,origin='upper') because the axis values gets messed up.
>>>
>>> It sounds like maybe you want to reverse the y-axis. Try 
>>> something like plt.gca().invert_yaxis() after your call to 
>>> contourf.
>>>
>>> Eric
>
From: Jeff W. <js...@fa...> - 2009年11月02日 15:53:00
Attachments: hexbin.py
Stephane Raynaud wrote:
> Ross,
>
>
> one way is to mask (or remove) ocean points using the _geoslib module 
> provided with basemap.
> When you create a Basemap instance, you can retrieve all its polygons 
> land (continents and islands) with "mymap.coastpolygons".
> Thay are stored as numpy arrays, and you can convert them to 
> _geoslib.Polygon objects :
>
> poly = _geoslib.Polygon(N.asarray(coastalpoly).T)
>
> Then you loop over all Polygons and all (x,y) points and test :
>
> good_point = _geoslib.Point((x,y)).within(poly)
>
> Thanks to this method, you can choose you optimal resolution.
> You can even compute the intersection of you hexagons with coastal 
> polygons using .intersection() and .area (instead of simply checking 
> if the center is inside) and then reject points depending the fraction 
> of the cell covered by land (or ocean).
Following Stephane's excellent suggestion, here's a prototype Basemap 
method that checks to see if a point is on land or over water. Ross - 
if you find it useful I'll include it in the next release. Note that it 
will be slow for lots of points or large map regions.
-Jeff
>
> On Mon, Nov 2, 2009 at 8:07 AM, <Ros...@ga... 
> <mailto:Ros...@ga...>> wrote:
>
> Listers,
>
> I'm using basemap to plot randomly sampled values (x,y,z) through
> hexbin. This produces a very nice result. Some sample code is:
> ----------
> import numpy as np
> from numpy.random import seed
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
> from matplotlib.mlab import griddata
>
> ll_lat = -38.39477 # extent of area of interest
> ll_lon = 144.54767
> ur_lat = -37.51642
> ur_lon = 145.67144
>
> num_points = 100 # sample points
>
> # create random sampling over the area of interest
> seed(0)
> data = np.ones((3, num_points))
> data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
> data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
> data[2,:] *= np.random.random((num_points))*10000
>
> # plot the data
> fig = plt.figure()
> ax = fig.add_subplot(111)
> m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
> llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
> suppress_ticks=False, area_thresh=0.5)
> plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
> m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
> m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
> plt.show()
> ----------
>
> This contrived example shows a sparse set of hexagons on both land
> and ocean. I would like the hexagons over the ocean to be hidden.
> I can make the ones on land disappear by changing the 'zorder'
> parameter of .hexbin() to 0. However I have found no way of doing
> the inverse and hiding hexagons over the ocean.
>
> Using drawlsmask() is too crude at a 5-minute resolution.
>
> Any ideas?
>
> Thanks,
> Ross
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year.
> Jumpstart your
> developing skills, take BlackBerry mobile applications to market
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> -- 
> Stephane Raynaud
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
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: Stephane R. <ste...@gm...> - 2009年11月02日 09:00:32
Ross,
one way is to mask (or remove) ocean points using the _geoslib module
provided with basemap.
When you create a Basemap instance, you can retrieve all its polygons land
(continents and islands) with "mymap.coastpolygons".
Thay are stored as numpy arrays, and you can convert them to
_geoslib.Polygon objects :
poly = _geoslib.Polygon(N.asarray(coastalpoly).T)
Then you loop over all Polygons and all (x,y) points and test :
good_point = _geoslib.Point((x,y)).within(poly)
Thanks to this method, you can choose you optimal resolution.
You can even compute the intersection of you hexagons with coastal polygons
using .intersection() and .area (instead of simply checking if the center is
inside) and then reject points depending the fraction of the cell covered by
land (or ocean).
On Mon, Nov 2, 2009 at 8:07 AM, <Ros...@ga...> wrote:
> Listers,
>
> I'm using basemap to plot randomly sampled values (x,y,z) through hexbin.
> This produces a very nice result. Some sample code is:
> ----------
> import numpy as np
> from numpy.random import seed
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
> from matplotlib.mlab import griddata
>
> ll_lat = -38.39477 # extent of area of interest
> ll_lon = 144.54767
> ur_lat = -37.51642
> ur_lon = 145.67144
>
> num_points = 100 # sample points
>
> # create random sampling over the area of interest
> seed(0)
> data = np.ones((3, num_points))
> data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
> data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
> data[2,:] *= np.random.random((num_points))*10000
>
> # plot the data
> fig = plt.figure()
> ax = fig.add_subplot(111)
> m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
> llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
> suppress_ticks=False, area_thresh=0.5)
> plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
> m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
> m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
> plt.show()
> ----------
>
> This contrived example shows a sparse set of hexagons on both land and
> ocean. I would like the hexagons over the ocean to be hidden. I can make
> the ones on land disappear by changing the 'zorder' parameter of .hexbin()
> to 0. However I have found no way of doing the inverse and hiding hexagons
> over the ocean.
>
> Using drawlsmask() is too crude at a 5-minute resolution.
>
> Any ideas?
>
> Thanks,
> Ross
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Stephane Raynaud
From: <Ros...@ga...> - 2009年11月02日 07:08:21
Listers,
I'm using basemap to plot randomly sampled values (x,y,z) through hexbin. This produces a very nice result. Some sample code is:
----------
import numpy as np
from numpy.random import seed
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.mlab import griddata
ll_lat = -38.39477 # extent of area of interest
ll_lon = 144.54767
ur_lat = -37.51642
ur_lon = 145.67144
num_points = 100 # sample points
# create random sampling over the area of interest
seed(0)
data = np.ones((3, num_points))
data[0,:] *= ll_lon + np.random.random((num_points))*(ur_lon-ll_lon)
data[1,:] *= ll_lat + np.random.random((num_points))*(ur_lat-ll_lat)
data[2,:] *= np.random.random((num_points))*10000
# plot the data
fig = plt.figure()
ax = fig.add_subplot(111)
m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
 llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f',
 suppress_ticks=False, area_thresh=0.5)
plt.hexbin(data[0,:], data[1,:], data[2,:], zorder=3)
m.fillcontinents(color=(0.8,0.8,0.8,0), zorder=1)
m.drawcoastlines(linewidth=0.25, color='k', zorder=2)
plt.show()
----------
This contrived example shows a sparse set of hexagons on both land and ocean. I would like the hexagons over the ocean to be hidden. I can make the ones on land disappear by changing the 'zorder' parameter of .hexbin() to 0. However I have found no way of doing the inverse and hiding hexagons over the ocean.
Using drawlsmask() is too crude at a 5-minute resolution.
Any ideas?
Thanks,
Ross
From: Eric F. <ef...@ha...> - 2009年11月02日 03:26:56
R. Mitra wrote:
> Hi
> I am having problems with contourf(). Suppose I have two 10X30 
> arrays X,Y and a corresponding Z value array. How do I make the 
> upper left to be the origin? I cannot use contour (Z,origin='upper') 
> because the axis values gets messed up.
It sounds like maybe you want to reverse the y-axis. Try something like 
 plt.gca().invert_yaxis() after your call to contourf.
Eric
From: R. M. <rm...@uc...> - 2009年11月01日 21:50:49
Hi
 I am having problems with contourf(). Suppose I have two 10X30 
arrays X,Y and a corresponding Z value array. How do I make the 
upper left to be the origin? I cannot use contour (Z,origin='upper') 
because the axis values gets messed up.
Thanks
Mitra
11 messages has been excluded from this view by a project administrator.

Showing results of 346

<< < 1 .. 12 13 14 (Page 14 of 14)
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 によって変換されたページ (->オリジナル) /