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 18 results of 18

From: Eric F. <ef...@ha...> - 2009年11月04日 18:01:33
John Hunter wrote:
> On Wed, Nov 4, 2009 at 11:16 AM, Brendan Arnold <bre...@gm...> wrote:
>> Ah, I was a little confused by what you wrote John (I though I had to
>> access contour through the axes object and the meaning of R, F, dR was
>> a little unclear..) however using the 'levels' keyword now works. i.e.
>>
>> plt.contour(x, y, z, levels=[0])
>>
>> Incidentally, this keyword (levels) is not documented at
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour
>> and in fact the documentation implies that contour(kx, ky, z, [0])
>> should work when it does not.
But it does work, as it should:
x = arange(5)
y = arange(7)
X, Y = meshgrid(x,y)
z = X+Y
contour(X, Y, z, [5])
Drop the above into "ipython -pylab".
Eric
>>
>> Perhaps the docs could be updated to reflect this?
> 
> Thanks for the heads up -- I updated the docstring in svn HEAD
> 
> Sorry the original example was confusing -- I cut and pasted from some
> code I was working on, and forgot to import the mindreading module
> 
> JDH
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: <qu...@gm...> - 2009年11月04日 17:56:55
Greetings.
I would like to make a mplot3d.bar3d plot where the colour indicates
the value of the element. Like: negative values blue, positive red,
zero green. From what i see i can only give all bars the same 
color ... Is there a way around it?
I know that this is currently done in mayavi, but mayavi also
seems to be tons slower.
thanks for any help
with best regards,
q
-- 
The king who needs to remind his people of his rank, is no king.
To gain that which is worth having, it may be necessary to lose everything else.
From: <PH...@Ge...> - 2009年11月04日 17:54:02
> On Wed, Nov 4, 2009 at 11:25 AM, <PH...@ge...> wrote:
> > I know support for the usetex feature is limited, but I think
> (*hope*) that this is purely an MPL question and not out of the scope
> and annoying to the members of the group.
> >
> > I like to use the fourier.sty package since I like the Utopia font
> and it's math font is particularly nice. But MPL is using this Latex
> installation:
> > /sw/share/texmf-dist/tex/latex/
> > which has no fourier package, and raises predictable errors when I
> set
> > text.latex.preamble : \usepackage{fourier}
> >
> > But I only use and maintain this one:
> > /usr/local/texlive/2008/texmf-dist/tex/latex/
> > (fourier and many other packages I like)
From: John Hunter [mailto:jd...@gm...]
Sent: Wednesday, November 04, 2009 9:33 AM
> This looks like a UNIX PATH issue -- mpl will use the version of latex
> it finds first in your PATH, so if you want it to find
> /usr/local/texlive/2008/texmf-dist/tex/latex/, put the directory
> containing that latex ahead of the fink one (/sw)
Thanks, John. Looks like I can take from here. I'll add my Texlive directory to near the top of the path.
-paul
From: John H. <jd...@gm...> - 2009年11月04日 17:33:28
On Wed, Nov 4, 2009 at 11:25 AM, <PH...@ge...> wrote:
> I know support for the usetex feature is limited, but I think (*hope*) that this is purely an MPL question and not out of the scope and annoying to the members of the group.
>
> I like to use the fourier.sty package since I like the Utopia font and it's math font is particularly nice. But MPL is using this Latex installation:
> /sw/share/texmf-dist/tex/latex/
> which has no fourier package, and raises predictable errors when I set
> text.latex.preamble : \usepackage{fourier}
>
> But I only use and maintain this one:
> /usr/local/texlive/2008/texmf-dist/tex/latex/
> (fourier and many other packages I like)
This looks like a UNIX PATH issue -- mpl will use the version of latex
it finds first in your PATH, so if you want it to find
/usr/local/texlive/2008/texmf-dist/tex/latex/, put the directory
containing that latex ahead of the fink one (/sw)
From: John H. <jd...@gm...> - 2009年11月04日 17:31:18
On Wed, Nov 4, 2009 at 11:16 AM, Brendan Arnold <bre...@gm...> wrote:
> Ah, I was a little confused by what you wrote John (I though I had to
> access contour through the axes object and the meaning of R, F, dR was
> a little unclear..) however using the 'levels' keyword now works. i.e.
>
> plt.contour(x, y, z, levels=[0])
>
> Incidentally, this keyword (levels) is not documented at
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour
> and in fact the documentation implies that contour(kx, ky, z, [0])
> should work when it does not.
>
> Perhaps the docs could be updated to reflect this?
Thanks for the heads up -- I updated the docstring in svn HEAD
Sorry the original example was confusing -- I cut and pasted from some
code I was working on, and forgot to import the mindreading module
JDH
From: <PH...@Ge...> - 2009年11月04日 17:25:31
I know support for the usetex feature is limited, but I think (*hope*) that this is purely an MPL question and not out of the scope and annoying to the members of the group.
I like to use the fourier.sty package since I like the Utopia font and it's math font is particularly nice. But MPL is using this Latex installation:
/sw/share/texmf-dist/tex/latex/
which has no fourier package, and raises predictable errors when I set
text.latex.preamble : \usepackage{fourier}
But I only use and maintain this one:
/usr/local/texlive/2008/texmf-dist/tex/latex/
(fourier and many other packages I like)
Is there a way to tell MPL to use my preferred Latex directory, or should I update and maintain the one it currently searches?
Mac OS 10.5
MPL 0.99.1
Many 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: Brendan A. <bre...@gm...> - 2009年11月04日 17:16:45
Ah, I was a little confused by what you wrote John (I though I had to
access contour through the axes object and the meaning of R, F, dR was
a little unclear..) however using the 'levels' keyword now works. i.e.
plt.contour(x, y, z, levels=[0])
Incidentally, this keyword (levels) is not documented at
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour
and in fact the documentation implies that contour(kx, ky, z, [0])
should work when it does not.
Perhaps the docs could be updated to reflect this?
Brendan
On Tue, Nov 3, 2009 at 2:19 PM, Brendan Arnold <bre...@gm...> wrote:
> Hi again,
>
> Thanks for the responses, however neither work, the error still
> persists. Here are more details...
>
> Traceback (most recent call last):
> File "C:\Program Files\Python2円.5\lib\lib-tk\Tkinter.py", line 1403,
> in __call__
>  return self.func(*args)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\backends\backend_tkagg.py",
> line 212, in resize
>  self.show()
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\backends\backend_tkagg.py",
> line 215, in draw
>  FigureCanvasAgg.draw(self)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 314, in draw
>  self.figure.draw(self.renderer)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>  draw(artist, renderer, *kl)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\figure.py", line 773, in
> draw
>  for a in self.axes: a.draw(renderer)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\artist.py", line 46, in
> draw_wrapper
>  draw(artist, renderer, *kl)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\axes.py", line 1735, in
> draw
>  a.draw(renderer)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\text.py", line 515, in
> draw
>  bbox, info = self._get_layout(renderer)
> File "C:\Program
> Files\Python2円.5\lib\site-packages\matplotlib\text.py", line 257, in
> _get_layout
>  if key in self.cached: return self.cached[key]
> TypeError: unhashable type: 'numpy.ndarray'
>
>>>> matplotlib.__version__
> '0.99.1'
>>>> numpy.__version__
> '1.3.0'
>
> Python version 2.5
>
> the code in full is as follows,
>
> import matplotlib
> import numpy as np
> import matplotlib.cm as cm
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
>
> # Set some model parameters
> model_points = 10000
> t0 = 0.38
> t1 = 0.32*t0
> t2 = 0.5*t1
>
> def energy(kx, ky):
>  '''Energy function, evetually this will be provided by raw data
> from WIEN2k'''
>  return -2*t0*(np.cos(kx)+np.cos(ky)) \
>    + 4*t1*np.cos(kx)*np.cos(ky) \
>    - 2*t2*(np.cos(2*kx)+np.cos(2*ky))
>
> def shift_energy_up(energy_val, dE):
>  '''Shifts the energy according to a gap'''
>  return energy_val + np.sqrt(energy_val**2 + dE**2)
>
> def shift_energy_dn(energy_val, dE):
>  '''Shifts the energy down according to an energy'''
>  return energy_val - np.sqrt(energy_val**2 + dE**2)
>
> kx = np.arange(0, 2*np.pi, 2*np.pi/np.sqrt(model_points))
> ky = np.arange(0, 2*np.pi, 2*np.pi/np.sqrt(model_points))
> mgx, mgy = np.meshgrid(kx, ky)
> z = energy(mgx, mgy)
>
> # Set the ticks to go outwards
> matplotlib.rcParams['xtick.direction'] = 'out'
> matplotlib.rcParams['ytick.direction'] = 'out'
>
> plt.figure()
> CS = plt.contour(kx, ky, z, [0, 0])
> plt.clabel(CS, inline=1, fontsize=10)
> plt.title('Simplest default with labels')
> plt.show()
>
>
> kind regards,
>
> Brendan
>
> On Mon, Nov 2, 2009 at 9:33 PM, Pierre de Buyl <pd...@ul...> wrote:
>> 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: <PH...@Ge...> - 2009年11月04日 17:07:35
> -----Original Message-----
> From: Tony S Yu [mailto:to...@MI...]
> Sent: Tuesday, November 03, 2009 1:11 PM
> To: Paul Hobson
> Cc: Matplotlib Users
> Subject: Re: [Matplotlib-users] Location matplotlibrc file on my Mac
> (Paul, I hope you don't mind if I bring this bump this back to the
> list).
> 
> Apparently I skimmed your original email and didn't see that you tried
> putting the file in your working directory. That should work. (My
> original response is still appropriate for a global rc file.)
> 
> As suggested on the mpl website (specifically:
> http://matplotlib.sourceforge.net/users/customizing.html
> ), you can try printing out the path of the rc file being used by
> adding the following to your script:
> 
> >>> import matplotlib
> >>> print matplotlib.matplotlib_fname()
> 
> Also, you may want to check that the working directory is where you
> think it is. For example, if you run a script from the terminal as:
> 
> $ python ~/path/to/file.py
> 
> Your working directory is '~' and not '~/path/to/'---so matplotlibrc
> file located in the same directory as file.py would not be in the
> working directory.
> 
> Otherwise, I have no idea why the matplotlibrc is not being found in
> the working directory.
> 
> Best,
> -Tony
I won't mention how long it had been so I had done this, but I had to move the file to /Users/paul/.matplotlib in Terminal since Mac OSX won't let you do that in Finder (sigh). This made everything work splendidly. I even got it to work in the present working directory (not sure how I was messing that up earlier).
Thanks so much, Tony.
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: Jae-Joon L. <lee...@gm...> - 2009年11月04日 14:20:33
Are you running svn version of mpl?
Also, as I said, the example is based on the patch yet to be submitted.
So, I can send you the example, but it will take me sometime to commit
the patch.
I'll give you a notice when this happen.
As far as rotating the ticks, if you're using markers, than I guess
you need a custom artist class.
So, I recommend you to just use simple lines.
Whatever path you take (even with my example), it will not be easy.
So, again, finding other plotting tool that support cone plots may be
more practical (unless someone comes up with a working example).
Regards,
-JJ
On Wed, Nov 4, 2009 at 2:44 AM, ifriad <if...@gm...> wrote:
>
> Hi,
> Thanks, I think the attached sample is good enough for me, In fact I got
> something similar except for the ticks I didn't know how to make them
> slanted, so If I can get the code for you plot this will be really great.
>
> I can then fine tune it to my needs.
>
> Thanks Ihab
>
> Jae-Joon Lee wrote:
>>
>> 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
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
>>
>
> --
> View this message in context: http://old.nabble.com/cone-plots-tp26140834p26192193.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
Indeed, my version is 98.3. I'll update. Thanks!
Greg
On Wed, Nov 4, 2009 at 9:03 AM, Jae-Joon Lee <lee...@gm...> wrote:
> On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <no...@uc...> wrote:
>> Is this the intended behavior? How can I get complete sample lines
>> when the legend lies outside the plot area?
>
> No, this is not intended.
> It seems to me that wrong clip path is set for those legend handles.
> However, your code works fine with the svn version of mpl and also
> with the 0.99.1.
> So, maybe this is an old bug that has been fixed.
> Can you check your matplotlib version and, if possible, update to newer version?
> Or, if you report your version of mpl, I'll see if I can find any workaround.
>
> -JJ
>
From: Jae-Joon L. <lee...@gm...> - 2009年11月04日 14:04:01
On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <no...@uc...> wrote:
> Is this the intended behavior? How can I get complete sample lines
> when the legend lies outside the plot area?
No, this is not intended.
It seems to me that wrong clip path is set for those legend handles.
However, your code works fine with the svn version of mpl and also
with the 0.99.1.
So, maybe this is an old bug that has been fixed.
Can you check your matplotlib version and, if possible, update to newer version?
Or, if you report your version of mpl, I'll see if I can find any workaround.
-JJ
From: Stephane R. <ste...@gm...> - 2009年11月04日 09:24:44
Maybe using path clipping you can plot only over land like this :
----------------------------------------------------------------------------------
import numpy as np
from mpl_toolkits.basemap import Basemap
import pylab as plt
import matplotlib.patches as patches
import matplotlib.transforms as transforms
ll_lat = -38.10 # extent of area of interest
ll_lon = 145.06
ur_lat = -38.00
ur_lon = 145.16
# create data points all on land
fudge = ((ll_lon+0.05, ur_lat-0.00, 1000),
 (ll_lon+0.05, ur_lat-0.01, 2000),
 (ll_lon+0.05, ur_lat-0.02, 3000),
 (ll_lon+0.05, ur_lat-0.03, 4000),
 (ll_lon+0.04, ur_lat-0.025, 1000),
 (ll_lon+0.043, ur_lat-0.036, 10000),
 (ll_lon+0.047, ur_lat-0.041, 20000),
 (ll_lon+0.07, ur_lat-0.07, 4000),
 (ll_lon+0.08, ur_lat-0.08, 3000),
 (ll_lon+0.09, ur_lat-0.09, 2000),
 (ll_lon+0.10, ur_lat-0.10, 1000))
data = np.ones((3, len(fudge)))
for (i, (lon, lat, val)) in enumerate(fudge):
 data[0,i] = lon
 data[1,i] = lat
 data[2,i] = val
# plot the data
fig = plt.figure()
m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
 llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f')
# +CHANGES
coll = plt.hexbin(data[0,:], data[1,:], data[2,:], gridsize=5)
ax = plt.gca()
for n, poly in enumerate(m.coastpolygons):
 type = m.coastpolygontypes[n]
 if type in [1,3]:
 p = patches.Polygon(np.asarray(poly).T)
 p.set_color('none')
 ax.add_patch(p)
 m.set_axes_limits(ax=ax)
 coll.set_clip_path(p)
# -CHANGES
plt.show()
----------------------------------------------------------------------------------
On Wed, Nov 4, 2009 at 1:17 AM, <Ros...@ga...> wrote:
>
>
> -----Original Message-----
> From: Jeff Whitaker [mailto:js...@fa...]
> Sent: Tuesday, 3 November 2009 02:53
> To: Stephane Raynaud
> Cc: Wilson Ross; mat...@li...
> Subject: Re: [Matplotlib-users] basemap: Mask the ocean [SEC=UNCLASSIFIED]
>
> 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
> --------------------------
>
> Yes, Stephane's approach is nice and Jeff has nicely encapsulated the
> approach. I'll put that into my bag of tricks!
>
> However it doesn't quite do what I want. My data does not have any points
> in the ocean; the hex binning creates hexagonal patches that extend out into
> the ocean. As a physicist I say "that's a representation artifact" and leave
> it at that, but my end-users want that 'bleed' into the ocean removed. My
> argument that they are losing data falls on deaf ears.
>
> Here's an even more contrived example that improves on my poor previous
> attempt to explain the problem:
> --------------------------------------------------------
> import numpy as np
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
>
> ll_lat = -38.10 # extent of area of interest
> ll_lon = 145.06
> ur_lat = -38.00
> ur_lon = 145.16
>
> # create data points all on land
> fudge = ((ll_lon+0.05, ur_lat-0.00, 1000),
> (ll_lon+0.05, ur_lat-0.01, 2000),
> (ll_lon+0.05, ur_lat-0.02, 3000),
> (ll_lon+0.05, ur_lat-0.03, 4000),
> (ll_lon+0.04, ur_lat-0.025, 1000),
> (ll_lon+0.043, ur_lat-0.036, 10000),
> (ll_lon+0.047, ur_lat-0.041, 20000),
> (ll_lon+0.07, ur_lat-0.07, 4000),
> (ll_lon+0.08, ur_lat-0.08, 3000),
> (ll_lon+0.09, ur_lat-0.09, 2000),
> (ll_lon+0.10, ur_lat-0.10, 1000))
>
> data = np.ones((3, len(fudge)))
> for (i, (lon, lat, val)) in enumerate(fudge):
> data[0,i] = lon
> data[1,i] = lat
> data[2,i] = val
>
> # plot the data
> fig = plt.figure()
> m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
> llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f')
> plt.hexbin(data[0,:], data[1,:], data[2,:], gridsize=5)
> m.drawcoastlines(linewidth=0.5, color='k')
> plt.show()
> --------------------------------------------------------
>
> None of the data points are on land, as can be seen if you change the
> 'gridsize' parameter to 100 or so (land is to the NE). However, when
> gridsize=5, the red hexagon in the middle extends out into the ocean. My
> users want that hexagon and others like it clipped at the coastline.
>
> Crazy people, users.
>
> Ross
>
-- 
Stephane Raynaud
From: ifriad <if...@gm...> - 2009年11月04日 07:44:38
Hi,
Thanks, I think the attached sample is good enough for me, In fact I got
something similar except for the ticks I didn't know how to make them
slanted, so If I can get the code for you plot this will be really great. 
I can then fine tune it to my needs.
Thanks Ihab
Jae-Joon Lee wrote:
> 
> 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
>>
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 
-- 
View this message in context: http://old.nabble.com/cone-plots-tp26140834p26192193.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ankita d. <ank...@gm...> - 2009年11月04日 05:05:06
hi all,
I am working on some graph stuffs and stuck at a point.
I am trying to plot a histogram using simple :
*import matplotlib.pyplot as plt
.
.
plt.hist(x,bins=10,histtype='bar')
plt.show
*
but i want to know
1) what is the value of a particular bar in histogram and also want to print
in on output image along with the bars ( either at top of bar or at bottom)*
*2) How to give input of 2 types of dataset in single hist() command , so
that i can compare 2 different dataset side by side on my output image. ( i
dont want it on top of each other as given by the command *histtype*: [
‘barstacked’] and also i read some example in matplotlib site, but they
are for random numbers : something like this:
x0 = mu + sigma*P.randn(10000)
x1 = mu + sigma*P.randn(7000)
x2 = mu + sigma*P.randn(3000)
P.figure()
n, bins, patches = P.hist( [x0,x1,x2], 10, histtype='bar')
but i need this comparision for some dataset.
thanx
ankita
Hello,
I am making a plot with a _lot_ of lines. There's no place within the
plot itself that the legend will fit without blocking anything. I
tried to put the legend outside the plot area by passing a tuple to
loc. This worked, but lines that are marked with symbols don't get
any sample line in the legend. That is:
>>> subplots_adjust(right=0.7); draw()
>>> xs=linspace(0,1,30);
>>> clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(0.8,0.1)); draw()
This works as expected, except the legend is inside the plot area
>>> clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(1.1,0.1)); draw()
This puts the legend in the right place (outside the plot area), but
the area to the left of 'data' in the legend (where the sample line
usually goes) is blank.
>>> clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(0.93,0.1)); draw()
This half draws one of the symbols that make up the sample inside the
legend. This seems to indicate that matplotlib will only draw symbols
when they lie inside a plot.
Is this the intended behavior? How can I get complete sample lines
when the legend lies outside the plot area?
Thank you,
Greg
From: ankita d. <ank...@gm...> - 2009年11月04日 04:56:36
-----------------------------------------------------------------------
ankita dutta wants to stay in better touch using some of Google's coolest new
products.
If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-b1ad2ac3cb-e5ed7b915c-9f37a145d10f2c61
You'll need to click this link to be able to chat with ankita dutta.
To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with ankita dutta, visit:
http://mail.google.com/mail/a-b1ad2ac3cb-e5ed7b915c-9f37a145d10f2c61
Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
 emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
 that are relevant to the content of your messages
All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:
http://www.google.com/talk/
Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
 client
We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!
Thanks,
The Google Team
To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html
(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).
From: priggs <ph...@ph...> - 2009年11月04日 00:30:29
Hi
When I try installing matplotlib version 99.1.1 on my Mac OS 10.5 using the
DMG I receive the following error:
"You cannot install matplotlib 0.99.1.1-r7813 on this volume. matplotlib
requires System Python 2.5 to install."
But I am using System Python 2.5:
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Why is it not recognizing Python?
Thanks!
PS. I also tried installing from source, but got the lipo error:
"src/ft2font.cpp:941: warning: control reaches end of non-void function
lipo: can't open input file:
/var/folders/eh/eh0fgkpOHKahCYCtazTUz++++TI/-Tmp-//ccYdEGvu.out (No such
file or directory)
error: command 'gcc' failed with exit status 1"
-- 
View this message in context: http://old.nabble.com/Install-problem-on-Mac-OS-10.5-tp26164460p26164460.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <Ros...@ga...> - 2009年11月04日 00:23:59
-----Original Message-----
From: Jeff Whitaker [mailto:js...@fa...]
Sent: Tuesday, 3 November 2009 02:53
To: Stephane Raynaud
Cc: Wilson Ross; mat...@li...
Subject: Re: [Matplotlib-users] basemap: Mask the ocean [SEC=UNCLASSIFIED]
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
--------------------------
Yes, Stephane's approach is nice and Jeff has nicely encapsulated the approach. I'll put that into my bag of tricks!
However it doesn't quite do what I want. My data does not have any points in the ocean; the hex binning creates hexagonal patches that extend out into the ocean. As a physicist I say "that's a representation artifact" and leave it at that, but my end-users want that 'bleed' into the ocean removed. My argument that they are losing data falls on deaf ears.
Here's an even more contrived example that improves on my poor previous attempt to explain the problem:
--------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
ll_lat = -38.10 # extent of area of interest
ll_lon = 145.06
ur_lat = -38.00
ur_lon = 145.16
# create data points all on land
fudge = ((ll_lon+0.05, ur_lat-0.00, 1000),
 (ll_lon+0.05, ur_lat-0.01, 2000),
 (ll_lon+0.05, ur_lat-0.02, 3000),
 (ll_lon+0.05, ur_lat-0.03, 4000),
 (ll_lon+0.04, ur_lat-0.025, 1000),
 (ll_lon+0.043, ur_lat-0.036, 10000),
 (ll_lon+0.047, ur_lat-0.041, 20000),
 (ll_lon+0.07, ur_lat-0.07, 4000),
 (ll_lon+0.08, ur_lat-0.08, 3000),
 (ll_lon+0.09, ur_lat-0.09, 2000),
 (ll_lon+0.10, ur_lat-0.10, 1000))
data = np.ones((3, len(fudge)))
for (i, (lon, lat, val)) in enumerate(fudge):
 data[0,i] = lon
 data[1,i] = lat
 data[2,i] = val
# plot the data
fig = plt.figure()
m = Basemap(projection='cyl', llcrnrlat=ll_lat, urcrnrlat=ur_lat,
 llcrnrlon=ll_lon, urcrnrlon=ur_lon, resolution='f')
plt.hexbin(data[0,:], data[1,:], data[2,:], gridsize=5)
m.drawcoastlines(linewidth=0.5, color='k')
plt.show()
--------------------------------------------------------
None of the data points are on land, as can be seen if you change the 'gridsize' parameter to 100 or so (land is to the NE). However, when gridsize=5, the red hexagon in the middle extends out into the ocean. My users want that hexagon and others like it clipped at the coastline.
Crazy people, users.
Ross
1 message has been excluded from this view by a project administrator.

Showing 18 results of 18

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 によって変換されたページ (->オリジナル) /