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




Showing 22 results of 22

From: James D. <jda...@un...> - 2010年11月11日 22:41:57
From: ben...@gm... [mailto:ben...@gm...] On Behalf Of Benjamin Root
Sent: Thursday, November 11, 2010 12:20 PM
To: James Davidheiser; Matplotlib Users
Subject: Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
On Thu, Nov 11, 2010 at 12:20 PM, Benjamin Root <ben...@ou...<mailto:ben...@ou...>> wrote:
On Thu, Nov 11, 2010 at 9:31 AM, James Davidheiser <jda...@un...<mailto:jda...@un...>> wrote:
From: ben...@gm...<mailto:ben...@gm...> [mailto:ben...@gm...<mailto:ben...@gm...>] On Behalf Of Benjamin Root
Sent: Thursday, November 11, 2010 8:19 AM
To: James Davidheiser
Cc: mat...@li...<mailto:mat...@li...>
Subject: Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
On Thu, Nov 11, 2010 at 8:49 AM, James Davidheiser <jda...@un...<mailto:jda...@un...>> wrote:
From: ben...@gm...<mailto:ben...@gm...> [mailto:ben...@gm...<mailto:ben...@gm...>] On Behalf Of Benjamin Root
On Wed, Nov 10, 2010 at 3:12 PM, unij <jda...@un...<mailto:jda...@un...>> wrote:
I'm trying to use mplot3d in a Wx based application, and most things seem to
be working fine. The one issue that keeps tripping me up is that the axes
labels are drawn at a weird angle. If I do the same type of plot without
using wx, then this problem goes away. I am completely stumped as to where
to even begin looking to fix this problem, so I would appreciate any
pointers you can give me.
I've attached a screenshot showing what I am talking about - a simple plot
where the axes labels look strange.
http://old.nabble.com/file/p30184616/mplot3d.jpg
I can reproduce the weird angle issue, but I can't seem to find a backend where it doesn't occur. Could you run "import matplotlib; print matplotlib.get_backend()" to determine which backend you are using when everything looks ok? Also, could you report the output of "matplotlib.__version__"?
If it happens for all backends then the problem is in mplot3d/axis3d.py. Unfortunately, the code there is a little light on commenting, but i don't notice any glaring mathematical error off the bat.
Ben Root
That's actually a really good point and something I didn't explain well - I didn't go out of my way to test with other backends, but rather I tried it by recreating the plot independently of my GUI, creating the same plot using pyplot, following the example in scatter3d_demo.py from the sourceforge demos page. If I then import matplotlib and check the backend, I get that it's TkAgg, but I'm not sure whether that backend is actually being used - is it?
I did just try changing between Wx and WxAgg for the backends, and the positions of the labels definitely move around in weird ways between the two, so I think I'm now even more confused than I was before.
James
The difference between a gui kit like Wx and its Agg equivalent is probably expected. Agg renderers bring additional capabilities and functionality with respect to rendering special vector-based graphics such as fonts. For example, while examining this bug, I noticed that the GTK backend can only represent fonts with either a 0 degree rotation, or 90 degree rotation, while the GTKAgg doesn't have that limitation.
I have tested Wx, WxAgg, GTK, GTKAgg, QTAgg, QT4Agg, and TkAgg and have found them all to be rotating the text incorrectly. GTK doesn't rotate at all, and emits an error (I wonder if we can catch this and perform an appropriate failback?). Wx does not appear to be performing the translation step properly, causing the label to appear on top of the tick labels. The other backends all seem to have similar results.
I wonder if the calculation for the text angle is off because maybe it is not using all 3 dimensions? In other words, the text appear to fail to take into account depth perception. I will take another peek at the code and see what I can figure out.
Ben Root
I also noticed that the problem is dependent on window / frame dimensions - resize the frame, and the angle changes. For nearly square windows, the angles are almost correct, but as you go to more rectangular aspect ratios, the text gets skewed. I'm guessing that means the error has something to do with the assumptions the code is making about how the window is scaled, which break down when you're not in a square.
James
Astute observation. Digging further, I have noticed that the source of the problem is that the angle given to a text object is relative to the display coordinate system. So, no matter how one resizes the figure window, the text angle is *always* the same. When the aspect ratio is square, then everything lines up right. I am going to look into making text objects aware of transforms for rotation purposes to fix this problem.
Ben Root
Success! There were two separate issues at play here. First, there was a slight mistake in calculating the 2D label location from the 3D location of the axis mid-point. This caused labels to not appear centered along the axis. This has been a long-standing bug that is now resolved by my patch.
The second issue is that when a Text object is given a rotation (in this case, by the Axis3D object). The rotation angle that a Text object expects is assumed to be for the display coordinate system. The angle that was calculated was for the axes coordinate system, which caused problems when the axes display aspect ratio was not equal (or square?). I might be mixing up some of the details because of the assumptions that are made in mplot3d.
A permanent solution would be to address the issue of how the rotation angle should be interpreted in a Text object. I can imagine several cases in 2D plots where the current behavior is undesirable.
However, for the purposes of mplot3d, because of its architecture, this angle gets recalculated for every re-draw anyway, so I decided to just properly calculate the angle at that point instead. I also made sure that the text object knows that I want its anchor point to be in the center of the text object for both horizontal and vertical alignment to make sure the object gets displayed properly.
I have attached the patch here. Feel free to try and break the alignment in case I missed something.
Ben Root
Thanks very much - the patch seems to work well and the axes look much better now.
I have a followup question, which is more of a generic mplot3d question - is there an easy way to tell mplot3d to add more space between the axes labels and the axes? I have some graphs where the number labels on the tickmarks overlap with the axes labels, and it would be nice to easily add a bit of room to clean everything up.
James
From: Benjamin R. <ben...@ou...> - 2010年11月11日 22:13:43
On Thu, Nov 11, 2010 at 3:55 PM, James Davidheiser <
jda...@un...> wrote:
> *From:* ben...@gm... [mailto:ben...@gm...] *On Behalf Of
> *Benjamin Root
> *Sent:* Thursday, November 11, 2010 12:20 PM
> *To:* James Davidheiser; Matplotlib Users
>
> *Subject:* Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
>
>
>
> On Thu, Nov 11, 2010 at 12:20 PM, Benjamin Root <ben...@ou...> wrote:
>
> On Thu, Nov 11, 2010 at 9:31 AM, James Davidheiser <
> jda...@un...> wrote:
>
>
>
>
>
> *From:* ben...@gm... [mailto:ben...@gm...] *On Behalf Of *Benjamin
> Root
> *Sent:* Thursday, November 11, 2010 8:19 AM
> *To:* James Davidheiser
> *Cc:* mat...@li...
> *Subject:* Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
>
>
>
> On Thu, Nov 11, 2010 at 8:49 AM, James Davidheiser <
> jda...@un...> wrote:
>
> *From:* ben...@gm... [mailto:ben...@gm...] *On Behalf Of *Benjamin
> Root
>
>
>
> On Wed, Nov 10, 2010 at 3:12 PM, unij <jda...@un...>
> wrote:
>
>
> I'm trying to use mplot3d in a Wx based application, and most things seem
> to
> be working fine. The one issue that keeps tripping me up is that the axes
> labels are drawn at a weird angle. If I do the same type of plot without
> using wx, then this problem goes away. I am completely stumped as to where
> to even begin looking to fix this problem, so I would appreciate any
> pointers you can give me.
>
> I've attached a screenshot showing what I am talking about - a simple plot
> where the axes labels look strange.
>
>
> http://old.nabble.com/file/p30184616/mplot3d.jpg
>
>
> I can reproduce the weird angle issue, but I can't seem to find a backend
> where it doesn't occur. Could you run "import matplotlib; print
> matplotlib.get_backend()" to determine which backend you are using when
> everything looks ok? Also, could you report the output of
> "matplotlib.__version__"?
>
> If it happens for all backends then the problem is in mplot3d/axis3d.py.
> Unfortunately, the code there is a little light on commenting, but i don't
> notice any glaring mathematical error off the bat.
>
> Ben Root
>
>
>
>
>
>
>
> That’s actually a really good point and something I didn’t explain well – I
> didn’t go out of my way to test with other backends, but rather I tried it
> by recreating the plot independently of my GUI, creating the same plot
> using pyplot, following the example in scatter3d_demo.py from the
> sourceforge demos page. If I then import matplotlib and check the backend,
> I get that it’s TkAgg, but I’m not sure whether that backend is actually
> being used – is it?
>
>
>
> I did just try changing between Wx and WxAgg for the backends, and the
> positions of the labels definitely move around in weird ways between the
> two, so I think I’m now even more confused than I was before.
>
>
>
> James
>
> The difference between a gui kit like Wx and its Agg equivalent is probably
> expected. Agg renderers bring additional capabilities and functionality
> with respect to rendering special vector-based graphics such as fonts. For
> example, while examining this bug, I noticed that the GTK backend can only
> represent fonts with either a 0 degree rotation, or 90 degree rotation,
> while the GTKAgg doesn't have that limitation.
>
> I have tested Wx, WxAgg, GTK, GTKAgg, QTAgg, QT4Agg, and TkAgg and have
> found them all to be rotating the text incorrectly. GTK doesn't rotate at
> all, and emits an error (I wonder if we can catch this and perform an
> appropriate failback?). Wx does not appear to be performing the translation
> step properly, causing the label to appear on top of the tick labels. The
> other backends all seem to have similar results.
>
> I wonder if the calculation for the text angle is off because maybe it is
> not using all 3 dimensions? In other words, the text appear to fail to take
> into account depth perception. I will take another peek at the code and see
> what I can figure out.
>
> Ben Root
>
>
>
>
>
> I also noticed that the problem is dependent on window / frame dimensions –
> resize the frame, and the angle changes. For nearly square windows, the
> angles are almost correct, but as you go to more rectangular aspect ratios,
> the text gets skewed. I’m guessing that means the error has something to do
> with the assumptions the code is making about how the window is scaled,
> which break down when you’re not in a square.
>
>
>
> James
>
> Astute observation. Digging further, I have noticed that the source of the
> problem is that the angle given to a text object is relative to the display
> coordinate system. So, no matter how one resizes the figure window, the
> text angle is *always* the same. When the aspect ratio is square, then
> everything lines up right. I am going to look into making text objects
> aware of transforms for rotation purposes to fix this problem.
>
> Ben Root
>
>
> Success! There were two separate issues at play here. First, there was a
> slight mistake in calculating the 2D label location from the 3D location of
> the axis mid-point. This caused labels to not appear centered along the
> axis. This has been a long-standing bug that is now resolved by my patch.
>
> The second issue is that when a Text object is given a rotation (in this
> case, by the Axis3D object). The rotation angle that a Text object expects
> is assumed to be for the display coordinate system. The angle that was
> calculated was for the axes coordinate system, which caused problems when
> the axes display aspect ratio was not equal (or square?). I might be mixing
> up some of the details because of the assumptions that are made in mplot3d.
>
> A permanent solution would be to address the issue of how the rotation
> angle should be interpreted in a Text object. I can imagine several cases
> in 2D plots where the current behavior is undesirable.
>
> However, for the purposes of mplot3d, because of its architecture, this
> angle gets recalculated for every re-draw anyway, so I decided to just
> properly calculate the angle at that point instead. I also made sure that
> the text object knows that I want its anchor point to be in the center of
> the text object for both horizontal and vertical alignment to make sure the
> object gets displayed properly.
>
> I have attached the patch here. Feel free to try and break the alignment
> in case I missed something.
>
> Ben Root
>
>
>
>
>
> Thanks very much – the patch seems to work well and the axes look much
> better now.
>
>
>
> I have a followup question, which is more of a generic mplot3d question –
> is there an easy way to tell mplot3d to add more space between the axes
> labels and the axes? I have some graphs where the number labels on the
> tickmarks overlap with the axes labels, and it would be nice to easily add a
> bit of room to clean everything up.
>
>
>
> James
>
Easy? Not really... this is going to be one of my next todos to make parts
of Axes3D to be more user-configurable. Right now, a lot of parameters such
as the panel colors, element spacing and such are all hard-coded
(particularly in axis3d.py). If you are feeling adventurous and really need
a fix, line 223 of axis3d.py reads as "labeldeltas = 1.3 * deltas" where you
could tweak the "1.3" number to bring the axis label closer/farther from the
axis. You can also tweak the "0.6" in line 278 ("labeldeltas = [0.6 * x for
x in deltas]") to bring the tick labels closer/farther from the axis.
I hope that helps, and I am glad the axis label looks much better now.
Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月11日 19:48:30
On Thu, Nov 11, 2010 at 8:28 AM, andres luhamaa <and...@gm...>wrote:
> Yes, Your script reproduced the problem.
>
> Regards,
> Andres
>
> On 11.11.2010 16:03, Scott Sinclair wrote:
> > A good start is always a self contained script illustrating the problem.
> >
> > I don't have GTKAgg installed here to try. Does the script below
> > reproduce your problem? If so, maybe someone else can reproduce it and
> > will take an interest in finding a fix..
> >
> > Cheers,
> > Scott
> >
> > ------------------------------------------
> > import matplotlib as mpl
> > mpl.use('GTKAgg')
> > from mpl_toolkits import basemap
> >
> > import matplotlib.pyplot as plt
> > from mpl_toolkits.basemap import Basemap
> >
> > title = 'Backend: %s - mpl version: %s - basemap version: %s' % \
> > (mpl.get_backend(), mpl.__version__, basemap.__version__)
> >
> > lat_0=58.5
> > lon_0=25.5
> > width=400000
> > height=400000
> >
> > m=Basemap(projection='aeqd',lat_0=lat_0,
> > lon_0=lon_0,width=width,height=height,resolution='i')
> >
> > m.drawmeridians(range(20,30),labels=[0,0,1,0])
> > m.drawparallels(range(45,65),labels=[1,0,0,0])
> >
> > ## what I expect to be map center
> > X,Y=m(lon_0,lat_0)
> > m.plot([X],[Y],'ko')
> > plt.text(X,Y,'expected centre')
> >
> > ## actual map center
> > X,Y=m(int(lon_0),int(lat_0))
> > m.plot([X],[Y],'ro')
> > plt.text(X,Y,'centre with GTKAgg')
> >
> > plt.suptitle(title)
> >
> > plt.show()
> >
>
I just tried out the script in a variety of different backends and I can't
notice a difference between any of them. Could we see a screenshot of what
it *isn't* supposed to look like?
Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月11日 15:19:04
On Thu, Nov 11, 2010 at 8:49 AM, James Davidheiser <
jda...@un...> wrote:
> *From:* ben...@gm... [mailto:ben...@gm...] *On Behalf Of
> *Benjamin Root
>
>
>
> On Wed, Nov 10, 2010 at 3:12 PM, unij <jda...@un...>
> wrote:
>
>
> I'm trying to use mplot3d in a Wx based application, and most things seem
> to
> be working fine. The one issue that keeps tripping me up is that the axes
> labels are drawn at a weird angle. If I do the same type of plot without
> using wx, then this problem goes away. I am completely stumped as to where
> to even begin looking to fix this problem, so I would appreciate any
> pointers you can give me.
>
> I've attached a screenshot showing what I am talking about - a simple plot
> where the axes labels look strange.
>
>
> http://old.nabble.com/file/p30184616/mplot3d.jpg
>
>
> I can reproduce the weird angle issue, but I can't seem to find a backend
> where it doesn't occur. Could you run "import matplotlib; print
> matplotlib.get_backend()" to determine which backend you are using when
> everything looks ok? Also, could you report the output of
> "matplotlib.__version__"?
>
> If it happens for all backends then the problem is in mplot3d/axis3d.py.
> Unfortunately, the code there is a little light on commenting, but i don't
> notice any glaring mathematical error off the bat.
>
> Ben Root
>
>
>
>
>
>
>
> That’s actually a really good point and something I didn’t explain well – I
> didn’t go out of my way to test with other backends, but rather I tried it
> by recreating the plot independently of my GUI, creating the same plot
> using pyplot, following the example in scatter3d_demo.py from the
> sourceforge demos page. If I then import matplotlib and check the backend,
> I get that it’s TkAgg, but I’m not sure whether that backend is actually
> being used – is it?
>
>
>
> I did just try changing between Wx and WxAgg for the backends, and the
> positions of the labels definitely move around in weird ways between the
> two, so I think I’m now even more confused than I was before.
>
>
>
> James
>
The difference between a gui kit like Wx and its Agg equivalent is probably
expected. Agg renderers bring additional capabilities and functionality
with respect to rendering special vector-based graphics such as fonts. For
example, while examining this bug, I noticed that the GTK backend can only
represent fonts with either a 0 degree rotation, or 90 degree rotation,
while the GTKAgg doesn't have that limitation.
I have tested Wx, WxAgg, GTK, GTKAgg, QTAgg, QT4Agg, and TkAgg and have
found them all to be rotating the text incorrectly. GTK doesn't rotate at
all, and emits an error (I wonder if we can catch this and perform an
appropriate failback?). Wx does not appear to be performing the translation
step properly, causing the label to appear on top of the tick labels. The
other backends all seem to have similar results.
I wonder if the calculation for the text angle is off because maybe it is
not using all 3 dimensions? In other words, the text appear to fail to take
into account depth perception. I will take another peek at the code and see
what I can figure out.
Ben Root
From: James D. <jda...@un...> - 2010年11月11日 15:05:43
From: ben...@gm... [mailto:ben...@gm...] On Behalf Of Benjamin Root
On Wed, Nov 10, 2010 at 3:12 PM, unij <jda...@un...<mailto:jda...@un...>> wrote:
I'm trying to use mplot3d in a Wx based application, and most things seem to
be working fine. The one issue that keeps tripping me up is that the axes
labels are drawn at a weird angle. If I do the same type of plot without
using wx, then this problem goes away. I am completely stumped as to where
to even begin looking to fix this problem, so I would appreciate any
pointers you can give me.
I've attached a screenshot showing what I am talking about - a simple plot
where the axes labels look strange.
http://old.nabble.com/file/p30184616/mplot3d.jpg
I can reproduce the weird angle issue, but I can't seem to find a backend where it doesn't occur. Could you run "import matplotlib; print matplotlib.get_backend()" to determine which backend you are using when everything looks ok? Also, could you report the output of "matplotlib.__version__"?
If it happens for all backends then the problem is in mplot3d/axis3d.py. Unfortunately, the code there is a little light on commenting, but i don't notice any glaring mathematical error off the bat.
Ben Root
That's actually a really good point and something I didn't explain well - I didn't go out of my way to test with other backends, but rather I tried it by recreating the plot independently of my GUI, creating the same plot using pyplot, following the example in scatter3d_demo.py from the sourceforge demos page. If I then import matplotlib and check the backend, I get that it's TkAgg, but I'm not sure whether that backend is actually being used - is it?
I did just try changing between Wx and WxAgg for the backends, and the positions of the labels definitely move around in weird ways between the two, so I think I'm now even more confused than I was before.
James
From: andres l. <and...@gm...> - 2010年11月11日 14:58:09
Yes, Your script reproduced the problem.
Regards,
Andres
On 11.11.2010 16:03, Scott Sinclair wrote:
> A good start is always a self contained script illustrating the problem.
>
> I don't have GTKAgg installed here to try. Does the script below
> reproduce your problem? If so, maybe someone else can reproduce it and
> will take an interest in finding a fix..
>
> Cheers,
> Scott
>
> ------------------------------------------
> import matplotlib as mpl
> mpl.use('GTKAgg')
> from mpl_toolkits import basemap
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.basemap import Basemap
>
> title = 'Backend: %s - mpl version: %s - basemap version: %s' % \
> (mpl.get_backend(), mpl.__version__, basemap.__version__)
>
> lat_0=58.5
> lon_0=25.5
> width=400000
> height=400000
>
> m=Basemap(projection='aeqd',lat_0=lat_0,
> lon_0=lon_0,width=width,height=height,resolution='i')
>
> m.drawmeridians(range(20,30),labels=[0,0,1,0])
> m.drawparallels(range(45,65),labels=[1,0,0,0])
>
> ## what I expect to be map center
> X,Y=m(lon_0,lat_0)
> m.plot([X],[Y],'ko')
> plt.text(X,Y,'expected centre')
>
> ## actual map center
> X,Y=m(int(lon_0),int(lat_0))
> m.plot([X],[Y],'ro')
> plt.text(X,Y,'centre with GTKAgg')
>
> plt.suptitle(title)
>
> plt.show()
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: Stefan M. <ste...@mn...> - 2010年11月11日 14:17:21
Hi JJ, 
thanks a lot for your Answer. Now I have understand how this works and
created my one formatter:
class MyFormatter(object):
 def __init__(self, fmt='$%f$'):
 self.fmt = fmt
 def __call__(self, direction, factor, values):
 return [self.fmt % v for v in values] 
Is there something like this already in Matplotlib? I looked into
axisartist but can not find anything similar. 
Regards 
Stefan 
On Thu, 2010年11月11日 at 09:38 +0900, Jae-Joon Lee wrote:
> How do you want your ticklabels formatted?
> 
> If axisartist does not provide a formatter that fits your need, you
> can create a custom formatter.
> Formatter for axisartist can be any callable object with following signature.
> 
> def Formatter(direction, factor, values):
> # ...
> return list_of_string_that corresponds_to_values
> 
> You may ignore direction and factor parameters for now.
> For example,
> 
> class MyFormatter(object):
> def __call__(self, direction, factor, values):
> _fmt = "$%.1f$"
> return [_fmt % v for v in values]
> 
> then you could do
> 
> grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
> 1000, 2000 ), tick_formatter1 = None, tick_formatter2 = MyFormatter() )
> 
> Regards,
> 
> -JJ
> 
> 
> On Wed, Nov 10, 2010 at 10:17 PM, Stefan Mauerberger
> <ste...@mn...> wrote:
> > Hello everyone,
> >
> > I have a question regarding the formatting of ticks in a curved
> > coordinate system. To create my plots I am useing the
> > mpl_toolkits.axisartist.floating_axes.GridHelperCurveLinear() function.
> > This works quite well but I have difficulties with formatting the axis.
> > I am working in a polar coordinate system. To format the longitudinal
> > axis I found the function
> > mpl_toolkits.axisartist.angle_helper.FormatterDMS() and it works good.
> > But I want to chance the formatting of the radius too. For this I need
> > to pass something to the kwargs tick_formatter2 of the function
> > GridHelperCurveLinear but I do not know what.
> >
> > Could you give me some advice?
> >
> > Regards
> >
> > Stefan
> >
> > Here is the code I use:
> >
> > import matplotlib.pyplot as plt
> > import mpl_toolkits.axisartist.floating_axes as floating_axes
> > from matplotlib.projections import PolarAxes
> >
> > fig = plt.figure()
> >
> > tr = PolarAxes.PolarTransform()
> >
> > grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
> > 1000, 2000 ), tick_formatter1 = None, tick_formatter2 = None )
> >
> > ax1 = floating_axes.FloatingSubplot( fig, 111, grid_helper=grid_helper )
> >
> > fig.add_subplot( ax1 )
> >
> > ax1.grid( True )
> >
> > plt.show()
> >
> >
> > ------------------------------------------------------------------------------
> > The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> > David G. Thomson, author of the best-selling book "Blueprint to a
> > Billion" shares his insights and actions to help propel your
> > business during the next growth cycle. Listen Now!
> > http://p.sf.net/sfu/SAP-dev2dev
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> 
From: Scott S. <sco...@gm...> - 2010年11月11日 14:04:10
On 11 November 2010 14:59, andres luhamaa <and...@gm...> wrote:
> Thanks, it really works with QT4Agg!
> Still, I think it would be better, if it worked with default GTKAgg as
> well. But my understanging of the whole matplotlib code is probably too
> general to submit a bug report somewhere.
A good start is always a self contained script illustrating the problem.
I don't have GTKAgg installed here to try. Does the script below
reproduce your problem? If so, maybe someone else can reproduce it and
will take an interest in finding a fix..
Cheers,
Scott
------------------------------------------
import matplotlib as mpl
mpl.use('GTKAgg')
from mpl_toolkits import basemap
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
title = 'Backend: %s - mpl version: %s - basemap version: %s' % \
 (mpl.get_backend(), mpl.__version__, basemap.__version__)
lat_0=58.5
lon_0=25.5
width=400000
height=400000
m=Basemap(projection='aeqd',lat_0=lat_0,
lon_0=lon_0,width=width,height=height,resolution='i')
m.drawmeridians(range(20,30),labels=[0,0,1,0])
m.drawparallels(range(45,65),labels=[1,0,0,0])
## what I expect to be map center
X,Y=m(lon_0,lat_0)
m.plot([X],[Y],'ko')
plt.text(X,Y,'expected centre')
## actual map center
X,Y=m(int(lon_0),int(lat_0))
m.plot([X],[Y],'ro')
plt.text(X,Y,'centre with GTKAgg')
plt.suptitle(title)
plt.show()
From: andres l. <and...@gm...> - 2010年11月11日 13:00:01
Thanks, it really works with QT4Agg!
Still, I think it would be better, if it worked with default GTKAgg as 
well. But my understanging of the whole matplotlib code is probably too 
general to submit a bug report somewhere.
Regards,
Andres
On 11.11.2010 14:12, Scott Sinclair wrote:
> Your script works fine for me, using the Qt4Agg backend (see
> http://imgur.com/bCPfy.png)
>
> You can determine which backend and Matplotlib/Basemap versions are
> being used on your computer if you include the following in your
> script:
>
> import matplotlib as mpl
> from mpl_toolkits import basemap
>
> print mpl.get_backend()
> print mpl.__version__
> print basemap.__version__
>
> Cheers,
> Scott
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
From: isolat <ill...@ya...> - 2010年11月11日 12:59:08
Hi, for 2d you can use basic contourf of maptplotlib, or 3d with
contourf3D(X,Y,Z) by using the mplot3d tookit.
see tutorial :
2d :
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contourf
3d :
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html
Daniele Nicolodi wrote:
> 
> Hello, I have a really dummy question.
> 
> I would like to plot an x, y, z table so that each region of the plot
> area defined by the coordinates (x, y) corresponds a color given by the
> value of z. I suppose this is a kind of basic functionality, but I'm
> unable to find the right function into matplotlib API.
> 
> Thank you. Cheers,
> -- 
> Daniele
> 
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a 
> Billion" shares his insights and actions to help propel your 
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/colormap-plot-tp30140282p30189782.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: mdekauwe <mde...@gm...> - 2010年11月11日 12:44:17
OK thanks so perhaps I should also try another backend then? What do other
mac users opt for?
ps. that works by the way.
John Hunter-4 wrote:
> 
> On Thu, Nov 11, 2010 at 6:32 AM, mdekauwe <mde...@gm...> wrote:
>>
>> It isn't any one script, if you did
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> x = np.arange(10)
>> for i in xrange(10):
>>  plt.plot(x)
>>  plt.savefig('x.png')
>>
>> it pops up the plot window even though I didn't ask it to. I don't get
>> this
>> functionality on a non mac system. So I wonder if it relates to the
>> choice
>> of backend
> 
> 
> I see -- so it is raising the window even w/o show. This is a bug,
> but a minor one. I suggest at the top of your script (before pyplot
> import) doing
> 
> import matplotlib
> matplotlib.use('agg')
> 
> if you only want to save hardcopy png -- macosx may not support
> offline rendering.
> 
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Mac-OSX-backend-tp30188676p30189678.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: isolat <ill...@ya...> - 2010年11月11日 12:41:34
hi all, 
please is there any one can tell me if it's possible in mplot3d to plot 3d
triangular mesh model with a colormap different from the Z variable. I
don't find example in tutorial for this.
thanks.
-- 
View this message in context: http://old.nabble.com/mplot3d---ploting-3d-triangular-mesh-model---need-help-tp30189662p30189662.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2010年11月11日 12:39:27
On Thu, Nov 11, 2010 at 6:32 AM, mdekauwe <mde...@gm...> wrote:
>
> It isn't any one script, if you did
>
> import numpy as np
> import matplotlib.pyplot as plt
> x = np.arange(10)
> for i in xrange(10):
>  plt.plot(x)
>  plt.savefig('x.png')
>
> it pops up the plot window even though I didn't ask it to. I don't get this
> functionality on a non mac system. So I wonder if it relates to the choice
> of backend
I see -- so it is raising the window even w/o show. This is a bug,
but a minor one. I suggest at the top of your script (before pyplot
import) doing
import matplotlib
matplotlib.use('agg')
if you only want to save hardcopy png -- macosx may not support
offline rendering.
From: mdekauwe <mde...@gm...> - 2010年11月11日 12:32:53
It isn't any one script, if you did
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
for i in xrange(10):
 plt.plot(x)
 plt.savefig('x.png')
it pops up the plot window even though I didn't ask it to. I don't get this
functionality on a non mac system. So I wonder if it relates to the choice
of backend
thanks
John Hunter-4 wrote:
> 
> 
> On Nov 11, 2010, at 4:15 AM, mdekauwe <mde...@gm...> wrote:
> 
>> 
>> Hi,
>> I have my backend set up in my .matplotlib/matplotlibrc file as:
>> 
>> backend : MacOSX
>> 
>> However if I run a script which does multiple plots and I don't ask the
>> script to display the plots (i.e. not imshow()), I still get blank
>> windows
>> popping up. Does anyone else have this problem? Any solutions?
>> 
> 
> Please post the script that is giving you problems
> 
> JDH
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Mac-OSX-backend-tp30188676p30189599.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Scott S. <sco...@gm...> - 2010年11月11日 12:12:44
On 11 November 2010 12:33, Andres Luhamaa <and...@gm...> wrote:
> I have a problem creating map in "aeqd" projection. The problem seems to be
> that the map center, given by arguments lon_0 and lat_0 is taking into
> account only full part of the coordinate. If I want to get map center at
> coordinates lon_0=25.5 and lat_0=58.5, I get center in lon_0=25 and
> lat_0=58, instead. I run numpy and matplotlib dev versions (a few weeks old)
> and basemap 1.0
Your script works fine for me, using the Qt4Agg backend (see
http://imgur.com/bCPfy.png)
You can determine which backend and Matplotlib/Basemap versions are
being used on your computer if you include the following in your
script:
import matplotlib as mpl
from mpl_toolkits import basemap
print mpl.get_backend()
print mpl.__version__
print basemap.__version__
Cheers,
Scott
From: John H. <jd...@gm...> - 2010年11月11日 11:54:23
On Nov 11, 2010, at 4:15 AM, mdekauwe <mde...@gm...> wrote:
> 
> Hi,
> I have my backend set up in my .matplotlib/matplotlibrc file as:
> 
> backend : MacOSX
> 
> However if I run a script which does multiple plots and I don't ask the
> script to display the plots (i.e. not imshow()), I still get blank windows
> popping up. Does anyone else have this problem? Any solutions?
> 
Please post the script that is giving you problems
JDH
From: Andres L. <and...@gm...> - 2010年11月11日 10:33:38
Hi,
I have a problem creating map in "aeqd" projection. The problem seems to be
that the map center, given by arguments lon_0 and lat_0 is taking into
account only full part of the coordinate. If I want to get map center at
coordinates lon_0=25.5 and lat_0=58.5, I get center in lon_0=25 and
lat_0=58, instead. I run numpy and matplotlib dev versions (a few weeks old)
and basemap 1.0
Best regards,
Andres Luhamaa
I use following example:
import pylab as plt
from mpl_toolkits.basemap import Basemap
lat_0=58.5
lon_0=25.5
width=400000
height=400000
m=Basemap(projection='aeqd',lat_0=lat_0,
lon_0=lon_0,width=width,height=height,resolution='i')
m.drawcoastlines()
m.drawmeridians(range(20,30),labels=[0,0,1,0])
m.drawparallels(range(45,65),labels=[1,0,0,0])
## what I expect to be map center
X,Y=m(lon_0,lat_0)
m.plot([X],[Y],'ko')
plt.text(X,Y,'expected')
## actual map center
X,Y=m(int(lon_0),int(lat_0))
m.plot([X],[Y],'ro')
plt.text(X,Y,'actual')
plt.show()
From: mdekauwe <mde...@gm...> - 2010年11月11日 10:16:01
Hi,
I have my backend set up in my .matplotlib/matplotlibrc file as:
backend : MacOSX
However if I run a script which does multiple plots and I don't ask the
script to display the plots (i.e. not imshow()), I still get blank windows
popping up. Does anyone else have this problem? Any solutions?
thanks,
Martin
-- 
View this message in context: http://old.nabble.com/Mac-OSX-backend-tp30188676p30188676.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Tim-- <qw...@ho...> - 2010年11月11日 08:54:16
Hello!
I have written a program that plots values over Time, because it has to be
done(plotted) fast the date_plot didnt fit the bill so i moved over to
Linecollection and it works like a charm. The only problem i have now is
that i dont know any easy way to get dates on the x-axis. Any ideas?
-- 
View this message in context: http://old.nabble.com/Linecollection%2C-Dates-on-X-axis-tp30188192p30188192.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michiel de H. <mjl...@ya...> - 2010年11月11日 02:21:27
I haven't been able to replicate this bug. With all matplotlib versions 
I tried (including 0.99.0, 0.99.1., 0.99.1.1, 0.99.1.2, 1.0.0, and the current source code in svn), this example works correctly with the Mac OS X backend.
Garry, what is the exact code that you are using?
--Michiel.
--- On Wed, 11/10/10, John Hunter <jd...@gm...> wrote:
> From: John Hunter <jd...@gm...>
> Subject: Re: [Matplotlib-users] python v ipython problem in imshow()
> To: "Michiel de Hoon" <mjl...@ya...>
> Cc: "Garry Willgoose" <Gar...@ne...>, mat...@li...
> Date: Wednesday, November 10, 2010, 10:59 AM
> On Wed, Nov 10, 2010 at 9:48 AM,
> Michiel de Hoon <mjl...@ya...>
> wrote:
> > Garry, if the bug still exists in matplotlib 1.0 could
> you open a bug report for it?
> 
> 
> I think Gary doesn't have easy access to 1.0. Here is
> the relevant
> example if anyone has 1.0 on macosx to test with
> 
>  http://matplotlib.sourceforge.net/examples/pylab_examples/image_origin.html
> 
> JDH
> 
 
From: Benjamin R. <ben...@ou...> - 2010年11月11日 01:23:57
On Wed, Nov 10, 2010 at 3:12 PM, unij <jda...@un...>wrote:
>
> I'm trying to use mplot3d in a Wx based application, and most things seem
> to
> be working fine. The one issue that keeps tripping me up is that the axes
> labels are drawn at a weird angle. If I do the same type of plot without
> using wx, then this problem goes away. I am completely stumped as to where
> to even begin looking to fix this problem, so I would appreciate any
> pointers you can give me.
>
> I've attached a screenshot showing what I am talking about - a simple plot
> where the axes labels look strange.
>
>
> http://old.nabble.com/file/p30184616/mplot3d.jpg
>
I can reproduce the weird angle issue, but I can't seem to find a backend
where it doesn't occur. Could you run "import matplotlib; print
matplotlib.get_backend()" to determine which backend you are using when
everything looks ok? Also, could you report the output of
"matplotlib.__version__"?
If it happens for all backends then the problem is in mplot3d/axis3d.py.
Unfortunately, the code there is a little light on commenting, but i don't
notice any glaring mathematical error off the bat.
Ben Root
From: Jae-Joon L. <lee...@gm...> - 2010年11月11日 00:39:04
How do you want your ticklabels formatted?
If axisartist does not provide a formatter that fits your need, you
can create a custom formatter.
Formatter for axisartist can be any callable object with following signature.
def Formatter(direction, factor, values):
 # ...
 return list_of_string_that corresponds_to_values
You may ignore direction and factor parameters for now.
For example,
class MyFormatter(object):
 def __call__(self, direction, factor, values):
 _fmt = "$%.1f$"
 return [_fmt % v for v in values]
then you could do
grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
1000, 2000 ), tick_formatter1 = None, tick_formatter2 = MyFormatter() )
Regards,
-JJ
On Wed, Nov 10, 2010 at 10:17 PM, Stefan Mauerberger
<ste...@mn...> wrote:
> Hello everyone,
>
> I have a question regarding the formatting of ticks in a curved
> coordinate system. To create my plots I am useing the
> mpl_toolkits.axisartist.floating_axes.GridHelperCurveLinear() function.
> This works quite well but I have difficulties with formatting the axis.
> I am working in a polar coordinate system. To format the longitudinal
> axis I found the function
> mpl_toolkits.axisartist.angle_helper.FormatterDMS() and it works good.
> But I want to chance the formatting of the radius too. For this I need
> to pass something to the kwargs tick_formatter2 of the function
> GridHelperCurveLinear but I do not know what.
>
> Could you give me some advice?
>
> Regards
>
> Stefan
>
> Here is the code I use:
>
> import matplotlib.pyplot as plt
> import mpl_toolkits.axisartist.floating_axes as floating_axes
> from  matplotlib.projections import PolarAxes
>
> fig = plt.figure()
>
> tr = PolarAxes.PolarTransform()
>
> grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
> 1000, 2000 ), tick_formatter1 = None, tick_formatter2 = None )
>
> ax1 = floating_axes.FloatingSubplot( fig, 111, grid_helper=grid_helper )
>
> fig.add_subplot( ax1 )
>
> ax1.grid( True )
>
> plt.show()
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
2 messages has been excluded from this view by a project administrator.

Showing 22 results of 22

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