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

From: Benjamin R. <ben...@ou...> - 2010年11月16日 22:07:01
On Tue, Nov 16, 2010 at 12:01 PM, Nicolas Bigaouette
<nbi...@gm...>wrote:
> Hi all,
>
> I have defined some shortcuts I often use using pylab.ginput(). I normally
> do:
>
>> fig = pylab.figure()
>
> fig.canvas.mpl_connect('key_press_event', on_key)
>
> with my "on_key" function being (simplified):
>
>> def on_key(event):
>
> if (event.key == 'q'):
>
> sys.exit(0)
>
> elif (event.key == 'w'):
>
> pylab.close(pylab.gcf())
>
> elif (event.key == 'd'):
>
> print "Please click two points to get the distance and slope."
>
> points = pylab.ginput(n=2, show_clicks=True)
>
> [...]
>
> pylab.plot([points[0][0], points[1][0]], [points[0][1],
>> points[1][1]], '+r', lw=1.0)
>
> pylab.plot([points[0][0], points[1][0]], [points[0][1],
>> points[1][1]], '--r', lw=1.0)
>
> pylab.draw()
>
>
> I'm plotting two markers where the user clicked and a line between them.
>
> This works fine, except when there is multiple subplots. I can correctly
> select points and get their position, but the plot commands will put the
> markers+line in the last subplot. I tried using "pylab.gca().plot()" but
> gca() always returns the last axes.
>
> My question is, how can I plot on the axes the user clicked on?
>
> Thank you!
>
>
While this isn't in the same approach you were going, you could continue to
use mpl_connect instead of ginput. If you create connections (and properly
disconnect as well) 'button_press_event' and 'button_release_event', you can
then utilize the event.inaxes property of the event object. This has an
added advantage of making sure that the mouse click events are inside the
axes.
Another approach might be to find out the bbox's of all the subplot axes and
see if a coordinate falls inside any of those.
Ben Root
Now I found a solution:
From the Education Repository of openSuse:
"URL: http://download.opensuse.org/repositories/Education/openSUSE_11.3/"
Install the packages:
 - python-numpy
 - python-matplotlib
These two seems to work together.
Have a nice day
-- 
mu...@pr...
From: Stan W. <sta...@nr...> - 2010年11月16日 18:43:41
> From: Gianfranco Durin [mailto:g....@in...] 
> Sent: Wednesday, November 10, 2010 11:32
> 
> Dear mpl users,
> I have the following problem to solve. Imagine to have the 
> simple example reported on website plotting the errorbars of 
> some x,y data:
...
> and if I change, for instance, y:
> 
> y = y/2.
> 
> I can easily replace the x,y with:
> 
> p[0].set_data(x,y)
> 
> but I do not know how to do the same for the errorbars.
I believe I see how you could do it. The errorbar call returns the tuple p =
(plotline, caplines, barlinecols) [1], and to update the errorbars, you must
modify the objects in the caplines and barlinecols lists. Each element of the
caplines list is a Line2D artist [2] for the left, right, top, or bottom caps;
you can use its methods set_data, set_xdata, or set_ydata to modify its
coordinates, as you did for the main line. Each element of the barlinecols
list is a LineCollection [3] artist responsible for all of the x or y
errorbars; you can use the set_segments method to provide new coordinates.
[1]
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.error
bar
[2]
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D
[3]
http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collecti
ons.LineCollection
From: Nicolas B. <nbi...@gm...> - 2010年11月16日 18:01:31
Hi all,
I have defined some shortcuts I often use using pylab.ginput(). I normally
do:
> fig = pylab.figure()
fig.canvas.mpl_connect('key_press_event', on_key)
with my "on_key" function being (simplified):
> def on_key(event):
 if (event.key == 'q'):
 sys.exit(0)
 elif (event.key == 'w'):
 pylab.close(pylab.gcf())
 elif (event.key == 'd'):
 print "Please click two points to get the distance and slope."
 points = pylab.ginput(n=2, show_clicks=True)
 [...]
 pylab.plot([points[0][0], points[1][0]], [points[0][1],
> points[1][1]], '+r', lw=1.0)
 pylab.plot([points[0][0], points[1][0]], [points[0][1],
> points[1][1]], '--r', lw=1.0)
 pylab.draw()
I'm plotting two markers where the user clicked and a line between them.
This works fine, except when there is multiple subplots. I can correctly
select points and get their position, but the plot commands will put the
markers+line in the last subplot. I tried using "pylab.gca().plot()" but
gca() always returns the last axes.
My question is, how can I plot on the axes the user clicked on?
Thank you!
N
From: Eric E. <eem...@es...> - 2010年11月16日 17:50:58
Dear Ben
thanks a lot for the quick reply.
I did that (and read some posts on the web) but no luck, as it says:
1.0.0
I in fact just went back to my openSuse 11.3 (Science repo) version because it 
went really wrong with scipy etc and I didn't want to mess up my setup. But 
still the same message with the Unknown projection.
I have checked the axes3d.py in my mpl_toolkits and it has the "name = '3d'" at 
the beginning and the register at the end...
???
Eric
> Could you please execute the following:
>
> import matplotlib
> print matplotlib.__version__
>
> and report back what it says? I suspect that when you installed the svn
> version, the original version of matplotlib is still getting loaded.
> The projection='3d' feature is brand new to 1.0.0.
>
> Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月16日 17:29:44
On Tue, Nov 16, 2010 at 11:24 AM, Eric Emsellem <eem...@es...> wrote:
> Dear Ben
>
> thanks a lot for the quick reply.
>
> I did that (and read some posts on the web) but no luck, as it says:
>
> 1.0.0
>
> I in fact just went back to my openSuse 11.3 (Science repo) version because
> it went really wrong with scipy etc and I didn't want to mess up my setup.
> But still the same message with the Unknown projection.
>
> I have checked the axes3d.py in my mpl_toolkits and it has the "name =
> '3d'" at the beginning and the register at the end...
>
> ???
>
>
> Eric
>
> Could you please execute the following:
>>
>> import matplotlib
>> print matplotlib.__version__
>>
>> and report back what it says? I suspect that when you installed the svn
>> version, the original version of matplotlib is still getting loaded.
>> The projection='3d' feature is brand new to 1.0.0.
>>
>> Ben Root
>>
>
Strange indeed. Ok, what does matplotlib.__file__ say? Does the filename
match the path you are expecting? At this point, I would also try putting
print statements in the register code at the end of axes3d.py to see if that
code path gets executed (can't see why not).
Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月16日 17:10:01
On Tue, Nov 16, 2010 at 10:48 AM, Eric Emsellem <eem...@es...> wrote:
> Hi,
>
> I have just installed the svn version of matplotlib and basemap + numpy
> from the
> svn repository of
>
> http://download.opensuse.org/repositories/home:/ocefpaf/openSUSE_11.3/x86_64/
>
> When I do:
> =======================================================
> ipython -pylab
> (matplotlib 1.0.0, backend GTKAgg version 2.17.0, openSuse 11.3 x86_64)
>
> import numpy as np
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> ========================================================
> I get a
>
> ValueError: Unknown projection '3d'
>
> I did the upgrade to the svn version because the previous one (which was
> already
> 1.0) gave me the same message...
>
> what's wrong here?
> (looked at the web and couldn't find out a good solution, beyond the
> upgrade I did)
>
> thanks in advance
> Eric
>
>
>
Eric,
Could you please execute the following:
import matplotlib
print matplotlib.__version__
and report back what it says? I suspect that when you installed the svn
version, the original version of matplotlib is still getting loaded. The
projection='3d' feature is brand new to 1.0.0.
Ben Root
From: Eric E. <eem...@es...> - 2010年11月16日 16:48:25
Hi,
I have just installed the svn version of matplotlib and basemap + numpy from the 
svn repository of
http://download.opensuse.org/repositories/home:/ocefpaf/openSUSE_11.3/x86_64/
When I do:
=======================================================
ipython -pylab
(matplotlib 1.0.0, backend GTKAgg version 2.17.0, openSuse 11.3 x86_64)
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
========================================================
I get a
ValueError: Unknown projection '3d'
I did the upgrade to the svn version because the previous one (which was already 
1.0) gave me the same message...
what's wrong here?
(looked at the web and couldn't find out a good solution, beyond the upgrade I did)
thanks in advance
Eric
From: Benjamin R. <ben...@ou...> - 2010年11月16日 15:57:02
On Sun, Nov 14, 2010 at 5:17 PM, Kornél Jahn <kja...@gm...> wrote:
> Hello,
> I would like to plot the polarization state of a two-dimensional vector
> field (linear, circular or generally elliptic), similarly to that seen on
> this ZEMAX plot:
> http://www.zemax.com/UserFiles/Image/UI/pol_pupil.gif
> It looks like some kind of enhanced quiver plot: a small line with arrows
> at both ends points out the local direction of linear polarization, while a
> directed ellipse with a given orientation of its axes depicts local
> elliptical polarization state (which becomes a circle for circular
> polarization).
>
> I am a novice matplotlib user, please give me some advice on how to start
> with implementing such a plot (what to read, API examples to look at etc.)
>
> Thanks,
> Kornel JAHN
>
>
Hmm, interesting idea. quiver.py is certainly the right place to start, but
I think there is one key missing feature in matplotlib: I haven't a clue how
one would draw a arrow in an ellipse shape.
As far as I know, such an arrow style isn't possible. What you could do
instead is to create a new class that is based on the ellipse collection
instead of the Quiver class. Once you get just basic ellipses drawn, then
maybe you can add some lines to the ellipses to indicate the direction of
spin, much like how the barbs are drawn in the Barbs class.
I hope this is helpful.
Ben Root
From: Guy G. <guy...@re...> - 2010年11月16日 15:50:24
On Tuesday 16 Nov 2010 15:35:31 Benjamin Root wrote:
> On Mon, Nov 15, 2010 at 4:14 AM, Guy Griffiths
> 
> <guy...@re...>wrote:
> > On Friday 12 Nov 2010 15:20:43 Ryan May wrote:
> > > On Fri, Nov 12, 2010 at 8:40 AM, Benjamin Root <ben...@ou...> wrote:
> > > > On Fri, Nov 12, 2010 at 5:11 AM, Guy Griffiths
> > > > <guy...@re...>
> > > > 
> > > > wrote:
> > > >> Hi,
> > > >> 
> > > >> I've been using matplotlib for a while for plotting scientific data,
> > 
> > and
> > 
> > > >> recently upgraded from version 0.99.1.1 to 1.0.0. Primarily I use
> > > >> pcolor to
> > > >> produce plots of concentration in 2D space. I use reasonably fine
> > > >> meshes, and
> > > >> in v0.99.1.1 the output looked great.
> > > >> 
> > > >> In v1.0.0, all of my plots (using the same code) have faint
> > > >> gridlines visible.
> > > >> Since the mesh I am using is quite fine, this makes the plots look
> > > >> terrible
> > > >> (i.e. more gridlines than actual data). This seems to be controlled
> > 
> > by
> > 
> > > >> the
> > > >> "edgecolors" keyword, but even when set to 'none' they are still
> > 
> > there.
> > 
> > > >> Is
> > > >> 
> > > >> there any way to remove them completely without reverting back to
> > > >> 0.99.1.1 (which I'd prefer not to do, since some of the API changes
> > 
> > are
> > 
> > > >> really useful
> > > >> for creating very polished graphs suitable for publication)?
> > > >> 
> > > >> imshow seems to have closer results to what I want (i.e. no
> > 
> > gridlines),
> > 
> > > >> but
> > > >> with imshow, the axes denote the pixel position, and there is no
> > 
> > option
> > 
> > > >> to display on polar axes (which is essential).
> > > >> 
> > > >> Any help would be much appreciated.
> > > >> 
> > > >> Regards,
> > > >> 
> > > >> Guy Griffiths
> > > > 
> > > > Guy, I have noticed something similar a few months ago with pcolor,
> > > > but
> > 
> > I
> > 
> > > > am not certain if it is the same problem as yours. First, which
> > 
> > backend
> > 
> > > > are you using? Second, are you seeing the grid lines in both the
> > 
> > figure
> > 
> > > > window and the saved output? Also, what format are you saving your
> > > > output to? Lastly, which pcolor function are you using (pcolor(),
> > > > pcolormesh(), pcolorfast())?
> > > > 
> > > > If you could include a screenshot or the saved file, I could see if
> > > > it
> > 
> > is
> > 
> > > > similar to my problem.
> > > 
> > > Yeah, I had noticed a problem with pcolor too. You can see the problem
> > 
> > > I've been seeing here:
> > http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.htm
> > l
> > 
> > > Calling pcolor with antialiased=False removes the lines, but that's
> > > just a workaround, not a solution. I'm not really sure where to start
> > > to track this down, so if anyone has a suggestion, I'm all ears.
> > > 
> > > Ryan
> > 
> > Hi,
> > 
> > Thanks for the help. The problem I'm seeing is as Ryan describes (same
> > effect
> > as in the screenshot, but let me know if you still want me to provide an
> > example), and appears in both the figure window and saved output (at
> > least png
> > and pdf). The backend I am using is Qt/Agg. I was using pcolor(), but
> > it appears that pcolormesh() doesn't (always) have this problem. 
> > Setting antialiased=False removes some of the problems. In summary:
> > 
> > pcolor(), antialiased=True - lines on screen, png, pdf
> > pcolor(), antialiased=False - lines on pdf, fine on png/screen
> > pcolormesh() - lines on pdf, fine on png/screen
> > 
> > Regards,
> > 
> > Guy
> 
> Guy,
> 
> I found my old bug report on this visual artifact. Oddly enough, the
> problem for me was with pcolormesh, not with pcolor. There is a script
> attached to the report that tests 4 combinations of function calls and
> rasterized=True. Could you see how it turns out for you?
> 
> Thanks,
> Ben Root
Ben,
I've run the script attached to the bug report. The results I got were as 
follows:
PNG - Artifacts on both pcolor() plots, no artifacts on either pcolormesh() 
plot
PDF - Artifacts on pcolor() and pcolormesh() with rasterized=False. Less 
obvious artifacts on pcolor() with rasterized=True. No artifacts on 
pcolormesh() with rasterized=True
EPS - Artifacts on pcolor() with rasterized=True. All others fine
SVG - Artifacts on pcolor() and pcolormesh() with rasterized=False. More 
obvious artifacts on pcolor() with rasterized=True. No artifacts on 
pcolormesh() with rasterized=True
Hope this is helpful.
Cheers,
Guy
From: Benjamin R. <ben...@ou...> - 2010年11月16日 15:35:58
On Mon, Nov 15, 2010 at 4:14 AM, Guy Griffiths
<guy...@re...>wrote:
>
> On Friday 12 Nov 2010 15:20:43 Ryan May wrote:
> > On Fri, Nov 12, 2010 at 8:40 AM, Benjamin Root <ben...@ou...> wrote:
> > > On Fri, Nov 12, 2010 at 5:11 AM, Guy Griffiths
> > > <guy...@re...>
> > >
> > > wrote:
> > >> Hi,
> > >>
> > >> I've been using matplotlib for a while for plotting scientific data,
> and
> > >> recently upgraded from version 0.99.1.1 to 1.0.0. Primarily I use
> > >> pcolor to
> > >> produce plots of concentration in 2D space. I use reasonably fine
> > >> meshes, and
> > >> in v0.99.1.1 the output looked great.
> > >>
> > >> In v1.0.0, all of my plots (using the same code) have faint gridlines
> > >> visible.
> > >> Since the mesh I am using is quite fine, this makes the plots look
> > >> terrible
> > >> (i.e. more gridlines than actual data). This seems to be controlled
> by
> > >> the
> > >> "edgecolors" keyword, but even when set to 'none' they are still
> there.
> > >> Is
> > >> there any way to remove them completely without reverting back to
> > >> 0.99.1.1 (which I'd prefer not to do, since some of the API changes
> are
> > >> really useful
> > >> for creating very polished graphs suitable for publication)?
> > >>
> > >> imshow seems to have closer results to what I want (i.e. no
> gridlines),
> > >> but
> > >> with imshow, the axes denote the pixel position, and there is no
> option
> > >> to display on polar axes (which is essential).
> > >>
> > >> Any help would be much appreciated.
> > >>
> > >> Regards,
> > >>
> > >> Guy Griffiths
> > >
> > > Guy, I have noticed something similar a few months ago with pcolor, but
> I
> > > am not certain if it is the same problem as yours. First, which
> backend
> > > are you using? Second, are you seeing the grid lines in both the
> figure
> > > window and the saved output? Also, what format are you saving your
> > > output to? Lastly, which pcolor function are you using (pcolor(),
> > > pcolormesh(), pcolorfast())?
> > >
> > > If you could include a screenshot or the saved file, I could see if it
> is
> > > similar to my problem.
> >
> > Yeah, I had noticed a problem with pcolor too. You can see the problem
> > I've been seeing here:
> >
> >
> http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html
> >
> > Calling pcolor with antialiased=False removes the lines, but that's
> > just a workaround, not a solution. I'm not really sure where to start
> > to track this down, so if anyone has a suggestion, I'm all ears.
> >
> > Ryan
>
> Hi,
>
> Thanks for the help. The problem I'm seeing is as Ryan describes (same
> effect
> as in the screenshot, but let me know if you still want me to provide an
> example), and appears in both the figure window and saved output (at least
> png
> and pdf). The backend I am using is Qt/Agg. I was using pcolor(), but it
> appears that pcolormesh() doesn't (always) have this problem. Setting
> antialiased=False removes some of the problems. In summary:
>
> pcolor(), antialiased=True - lines on screen, png, pdf
> pcolor(), antialiased=False - lines on pdf, fine on png/screen
> pcolormesh() - lines on pdf, fine on png/screen
>
> Regards,
>
> Guy
>
Guy,
I found my old bug report on this visual artifact. Oddly enough, the
problem for me was with pcolormesh, not with pcolor. There is a script
attached to the report that tests 4 combinations of function calls and
rasterized=True. Could you see how it turns out for you?
Thanks,
Ben Root
From: Benjamin R. <ben...@ou...> - 2010年11月16日 15:32:54
On Tue, Nov 16, 2010 at 8:27 AM, Marc Petersen <pet...@ya...>wrote:
> Hi,
>
> is there a solution for using matplotlib within pyside like it is
> possible with pyqt4?
>
> Greetz
> Marc
>
>
Marc,
Haven't tried it myself, but someone else did ask this a few months ago.
http://old.nabble.com/Matplotlib-and-PySide---td29716125.html
He didn't get far, but maybe you might have more luck?
Ben Root
From: Marc P. <pet...@ya...> - 2010年11月16日 14:27:07
Hi,
is there a solution for using matplotlib within pyside like it is
possible with pyqt4?
Greetz
Marc
From: Michael D. <md...@st...> - 2010年11月16日 14:03:55
Thanks. With this new script, I get only one failure:
xpdf_False
This is on RHEL5 x86_64:
gs 8.15.2
gv 3.6.8
pdftops 3.00
Cheers,
Mike
On 11/16/2010 06:54 AM, Jae-Joon Lee wrote:
> On Mon, Nov 15, 2010 at 11:29 PM, Michael Droettboom<md...@st...> wrote:
> 
>> How do I verify if the bbox is correct? Displaying them with gs, some of them have the plot centered on what looks to be a letter-sized page, and others are at the bottom, but none of them seem to be cropped. I'm happy to give a full detailed report, just not sure what I'm looking for in terms of right/wrong ;)
>>
>> Thanks,
>> Mike
>>
>> 
> Michael,
>
> Here is a slightly modified example.
>
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> plt.plot([0, 1, 1, 0], [0, 0, 1, 1], "ro", ms=10, transform=fig.transFigure,
> clip_on=False)
>
> for distiller in ["False", "xpdf", "ghostscript"]:
> for usetex in ["True", "False"]:
> plt.rcParams["ps.usedistiller"]=distiller
> plt.rcParams["text.usetex"]=usetex
>
> plt.savefig("test_bbox_%s_%s.eps" % (distiller, usetex))
>
> With this, you should see four red circles (a quadrant of a circle) at
> the four corner of page boundaries.
> I don't think "gs" is a right tool to test if the bbox is correct. My
> experience is that it often ignores the bbox. On linux, you may use
> "gv", "evince", or "okular".
>
> Regards,
>
> JJ
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Ian B. <ib...@pu...> - 2010年11月16日 01:52:08
All,
I have experience getting MPL working with wx backend with py2exe, and I
have sucessfully packaged and delivered py2exe executables (email me if you
would like a copy of the setup.py file that worked for me).
I have decided to switch my main development from wx to GTK since Glade is
so much easier to use (and get support for) than wxGlade.
Now my main problem is getting GTK to play nicely with MPL and py2exe. So
far Ive had no luck. The program runs perfectly when not packaged into an
executable FWIW. I copied my setup.py file at the end of the email.
 Perhaps someone has an idea. I import MPL with
import matplotlib
matplotlib.use('GTKAgg')
which immediately spits out an error:
(GTKAPP.exe:4188): GdkPixbuf-WARNING **: Cannot open pixbuf loader module
file 'gtk-2.0\gdk-pixbuf.loaders': No such file or directory
I tried to follow the recommendations of
http://www.py2exe.org/index.cgi/Py2exeAndPyGTK with moving the etc, share,
lib folders to the dist folder and I even in desperation added the etc,
share and lib folders to the path prior to importing MPL. No dice.
Any thoughts?
My setup.py that doesn't work with GTKAgg:
from distutils.core import setup
import py2exe
excludes = ['_tkagg', '_wxagg','_wx','_cocoaagg','_fltkagg','bsddb',
'curses', 'pywin.debugger',
 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
 'Tkconstants', 'Tkinter', 'pydoc', 'doctest', 'test', 'sqlite3',
 'projections','Tcl','PyQT4','qt','backend_qt','backend_qt4','backend_qt4agg',
 'backend_qtagg','backend_cairo','backend_cocoaagg','wx','scipy.sparse'
 ]
dll_excludes = ['QTGui4.dll','QtCore4.dll','tk85.dll','tcl85.dll']
data_files=['CurveFit.ui',]
packages = ['pygtk','matplotlib','encodings','gtk']
includes = ['cairo','pangocairo','atk','gobject','pango']
import matplotlib as mpl
data_files += mpl.get_py2exe_datafiles()
setup(
 name = 'FitTool',
 description = 'CurveFittingTool',
 version = '0.1',
 console = [
 {
 'script': 'GTKAPP.py',
 }
 ],
 options = {"py2exe": {"compressed": 2,
 "optimize": 2,
 "excludes": excludes,
 "packages": packages,
 "includes": includes,
 "dll_excludes": dll_excludes,
 # using 2 to reduce number of files in dist folder
 # using 1 is not recommended as it often does not
work
 "bundle_files": 2,
 "dist_dir": 'dist',
 "xref": False,
 "skip_archive": False,
 "ascii": False,
 "custom_boot_script": '',
 }
 },
 # using zipfile to reduce number of files in dist
 zipfile = r'libFiles\library.zip',
 data_files=data_files
)
----
Ian Bell
Graduate Research Assistant
Herrick Labs
Purdue University
email: ib...@pu...
cell: (607)227-7626
From: Jae-Joon L. <lee...@gm...> - 2010年11月16日 00:40:06
You may use annotate.
annotate("Test", xy=(0.5, 0.3), xycoords=("axes fraction", "data"), ha="center")
This requires v1.0 of matplotlib.
http://matplotlib.sourceforge.net/users/annotations_guide.html#using-complex-coordinate-with-annotation
Regards,
-JJ
From: Benjamin R. <ben...@ou...> - 2010年11月16日 00:27:56
On Mon, Nov 15, 2010 at 1:40 PM, <dav...@ub...> wrote:
> Hi
>
>
>
> I’d like to place a piece of text that shows the start of some data so I
> want data coords in the x direction and axis coords in the y – e.g. float
> with a particular x value and center in the screen on the y.
>
>
>
> Do I need to implement a new object or can I mix transforms in this manner?
>
>
>
> Many thx
>
>
>
> David
>
>
I believe "Blended" transformations is what you are looking for:
http://matplotlib.sourceforge.net/users/transforms_tutorial.html#blended-transformations
Haven't tried it myself, but the description seems right.
Ben Root

Showing 17 results of 17

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