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




Showing 12 results of 12

From: Eric F. <ef...@ha...> - 2011年05月17日 18:28:22
On 05/17/2011 01:53 AM, Joachim Saul wrote:
> All,
>
> I have stumbled upon a (for me) unexpected behaviour of axvspan().
>
>
> import matplotlib.pylab as plt
> from numpy import *
>
> x = arange(1000)
> y = 0.2*sin(0.02*x)
>
> ax = plt.axes()
> plt.axvspan(250, 400, facecolor='g', alpha=0.2)
> plt.plot(x,y)
> plt.show()
>
>
> The displayed y range is -0.2 to 1, while from the sine amplitude I
> would have expected -0.2 to 0.2. The expected y range can be obtained by
> omitting the axvspan() call and also if it is called *after* plot().
>
> Is this the desired behaviour, especially in view of the dependence on
> the call order?
No, it is a bug.
Eric
>
> __version__ is 1.1.0
>
> Cheers,
> Joachim
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Darren D. <dsd...@gm...> - 2011年05月17日 18:18:19
On Tue, May 17, 2011 at 2:05 PM, Neal Becker <ndb...@gm...> wrote:
> I have an old fedora 11 system. When I try to use latex math (e.g., $\mu=2$),
> it gives no error, but seems to produce gibberish (just ordinary ascii chars) in
> my pdf output.
>
> Any ideas how to debug?
Try using raw strings. If that doesn't work, try submitting a short example.
From: Neal B. <ndb...@gm...> - 2011年05月17日 18:06:08
I have an old fedora 11 system. When I try to use latex math (e.g., $\mu=2$), 
it gives no error, but seems to produce gibberish (just ordinary ascii chars) in 
my pdf output.
Any ideas how to debug?
I found that a trivial 'hello_world.tex' could run through pdflatex OK.
From: Benjamin R. <ben...@ou...> - 2011年05月17日 14:53:20
On Tue, May 17, 2011 at 7:08 AM, Neal Becker <ndb...@gm...> wrote:
> I have several line graphs on a single plot. I'd like to indicate what is
> the
> mean of each of them (they are showing cumulative distributions).
>
> Each is a different color.
>
> I tried putting 'mean=xxx' into the legend. That works, but I think it's
> confusing. The legend normally displays independent variables, not
> results.
>
> I put vertical lines and then text, vertically, just below the x-axis
> giving the
> mean values. Not very clear.
>
> This is not really a technical question, but one of presentation style.
> How to
> convey this information?
>
>
>
While I realize that you are not asking for the technical question of "how
to do this", but rather "how to do this so that it looks right", I want to
add some links to some examples on how to technically do annotations in case
anyone stumbles across this question while searching.
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo3.html
Ben Root
From: Benjamin R. <ben...@ou...> - 2011年05月17日 14:43:30
On Tue, May 17, 2011 at 2:58 AM, Johannes Radinger <JRa...@gm...> wrote:
>
> -------- Original-Nachricht --------
> > Datum: 2011年5月16日 11:36:18 -0500
> > Von: Benjamin Root <ben...@ou...>
> > An: Johannes Radinger <JRa...@gm...>
> > CC: mat...@li...
> > Betreff: Re: [Matplotlib-users] use matplotlib to produce mathathematical
> expression only
>
> > On Mon, May 16, 2011 at 11:22 AM, Johannes Radinger
> > <JRa...@gm...>wrote:
> >
> > >
> > > -------- Original-Nachricht --------
> > > > Datum: 2011年5月16日 10:59:34 -0500
> > > > Von: Benjamin Root <ben...@ou...>
> > > > An: Johannes Radinger <JRa...@gm...>
> > > > CC: mat...@li...
> > > > Betreff: Re: [Matplotlib-users] use matplotlib to produce
> > mathathematical
> > > expression only
> > >
> > > > On Mon, May 16, 2011 at 10:21 AM, Johannes Radinger
> > > > <JRa...@gm...>wrote:
> > > >
> > > > >
> > > > > -------- Original-Nachricht --------
> > > > > > Datum: 2011年5月16日 09:49:24 -0500
> > > > > > Von: Benjamin Root <ben...@ou...>
> > > > > > An: "mat...@li..." <
> > > > > mat...@li...>
> > > > > > Betreff: Re: [Matplotlib-users] [SciPy-User] use matplotlib to
> > > produce
> > > > > mathathematical expression only
> > > > >
> > > > > > On Monday, May 16, 2011, Johannes Radinger <JRa...@gm...>
> > wrote:
> > > > > > >
> > > > > > > -------- Original-Nachricht --------
> > > > > > >> Datum: 2011年5月16日 08:28:49 -0500
> > > > > > >> Von: Robert Kern <rob...@gm...>
> > > > > > >> An: SciPy Users List <sci...@sc...>
> > > > > > >> CC: mat...@li...
> > > > > > >> Betreff: Re: [Matplotlib-users] [SciPy-User] use matplotlib to
> > > > produce
> > > > > > mathathematical expression only
> > > > > > >
> > > > > > >> On Mon, May 16, 2011 at 08:21, Johannes Radinger <
> > > JRa...@gm...>
> > > > > > wrote:
> > > > > > >> > Hello,
> > > > > > >> >
> > > > > > >> > I want to produce a eps file of following mathematical
> > > > expression:
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$'
> > > > > > >> >
> > > > > > >> > is it possible to somehow missuse matplotlib for that to
> > produce
> > > > > only
> > > > > > >> the function without any other plot things? Or is there a
> > better
> > > > > python
> > > > > > >> library within scipy? I don't want to install the complete
> > latex
> > > > > > libraries just
> > > > > > >> for producing this single eps file.
> > > > > > >>
> > > > > > >> Check out mathtex. It is matplotlib's TeX parsing engine and
> > > > renderer
> > > > > > >> broken out into a separate library:
> > > > > > >>
> > > > > > >> http://code.google.com/p/mathtex/
> > > > > > >
> > > > > > > I also thought about mathtex but don't know how to use my
> > > > mathematical
> > > > > > expression without a plot of axis etc. any suggestions? I just
> > want
> > > to
> > > > > have
> > > > > > the formated math expression as eps and I don't know how to do
> it,
> > > > still
> > > > > > after reading in the matplotlib-manual.
> > > > > > >
> > > > > > > /johannes
> > > > > > >
> > > > > > >
> > > > > > >>
> > > > > > >> Also, please send matplotlib questions just to the matplotlib
> > > list.
> > > > > > >> Thanks.
> > > > > > >>
> > > > > > >> --
> > > > > > >> Robert Kern
> > > > > > >>
> > > > > > >> "I have come to believe that the whole world is an enigma, a
> > > > harmless
> > > > > > >> enigma that is made terrible by our own mad attempt to
> > interpret
> > > it
> > > > as
> > > > > > >> though it had an underlying truth."
> > > > > > >> -- Umberto Eco
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > >> Achieve unprecedented app performance and reliability
> > > > > > >> What every C/C++ and Fortran developer should know.
> > > > > > >> Learn how Intel has extended the reach of its next-generation
> > > tools
> > > > > > >> to help boost performance applications - inlcuding clusters.
> > > > > > >> http://p.sf.net/sfu/intel-dev2devmay
> > > > > > >> _______________________________________________
> > > > > > >> Matplotlib-users mailing list
> > > > > > >> Mat...@li...
> > > > > > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > > > > > >
> > > > > > > --
> > > > > > > NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> > > > > > > Jetzt informieren: http://www.gmx.net/de/go/freephone
> > > > > > > _______________________________________________
> > > > > > > SciPy-User mailing list
> > > > > > > Sci...@sc...
> > > > > > > http://mail.scipy.org/mailman/listinfo/scipy-user
> > > > > > >
> > > > > >
> > > > > > We have added a new feature to do just that in the development
> > > branch,
> > > > > > but it should be fairly trivial to do with existing releases of
> > > > > > matplotlib. Just create a figure object and use its figtitle to
> > hold
> > > > > > the expression and then save the figure.
> > > > >
> > > > > It might be trivial but how to remove the axis/plot then and crop
> > the
> > > > > extend of the eps?
> > > > >
> > > > > I tried:
> > > > >
> > > > > plt.figure()
> > > > >
> > > >
> > >
> >
> plt.title(r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$',
> > > > > fontsize=20)
> > > > > plt.show()
> > > > >
> > > > > /j
> > > > >
> > > > >
> > > > Use figtext instead. I did the following and it looked fine to me:
> > > >
> > > > plt.figure()
> > > > plt.figtext(0.1, 0.5,
> > > >
> > >
> >
> r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$',
> > > > fontsize=20)
> > > > plt.show()
> > > >
> > >
> > >
> > > thats working nearly perfect, I would just need to crop the display
> > extend
> > > resp. the white space from the eps around...any option/idea?
> > >
> > >
> > > /j
> > >
> > >
> > Try setting bbox_inches='tight' in the call to savefig. With
> > bbox_inches='tight', you can then specify the 'pad_inches' kwarg to
> > indicate
> > how much padding to put around the tight bounding box. This should work,
> > however some older version of matplotlib might not check the figure text
> > objects for calculating the tightest bounding box.
>
> Hej,
>
> I tried your suggestion like:
> plt.figure()
> plt.figtext(0.01,
> 0.5,r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$',
> fontsize=26)
> #plt.show()
> plt.savefig("testplot.eps", bbox_inches='tight')
>
> but get following error:
> plt.savefig("testplot.eps", bbox_inches='tight')
> File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py",
> line 363, in savefig
> return fig.savefig(*args, **kwargs)
> File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py",
> line 1084, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py",
> line 1891, in print_figure
> bbox_inches = self.figure.get_tightbbox(renderer)
> File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py",
> line 1212, in get_tightbbox
> _bbox = Bbox.union([b for b in bb if b.width!=0 or b.height!=0])
> File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/transforms.py",
> line 675, in union
> assert(len(bboxes))
> AssertionError
>
>
> For your information:
> I work with python 2.6.6 and matplotlib 1.0.1 on Mac OS X 10.6.6
>
> /j
>
>
>
There have been some bugs fixed with bbox_inches='tight', but I couldn't
remember if they happened after or before the v1.0.1 release. My guess is
that it happened after.
I am glad the other function worked for you.
Ben Root
From: Scott S. <sco...@gm...> - 2011年05月17日 12:53:37
---------- Forwarded message ----------
From: Scott Sinclair <sco...@gm...>
Date: 17 May 2011 14:52
Subject: Re: [Matplotlib-users] result in the graph
To: Waleria <wal...@gm...>
On 17 May 2011 14:35, Waleria <wal...@gm...> wrote:
> Hello all,
>
> I have this code: http://dpaste.com/543369/ (part that generates the chart)
> . So i need to show a result in the graph, i have the line 69 (variable
> x_sqr) in code, i need to show tthe result of variable in the graph. How can
> i do this?
How about:
import matplotlib.pyplot as plt
x_sqr = 42.42
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(5))
ax.text(3, 2, r'x$^2$ = %.2f' % x_sqr)
plt.show()
Cheers,
Scott
From: Waleria <wal...@gm...> - 2011年05月17日 12:52:12
Where did you change in the code?
Waléria
On Tue, May 17, 2011 at 9:46 AM, Sathishkumar Duraisamy <
flo...@gm...> wrote:
> On Tue, May 17, 2011 at 6:05 PM, Waleria <wal...@gm...> wrote:
> > Hello all,
> >
> > I have this code: http://dpaste.com/543369/ (part that generates the
> chart)
> > . So i need to show a result in the graph, i have the line 69 (variable
> > x_sqr) in code, i need to show tthe result of variable in the graph. How
> can
> > i do this?
> may be useful http://dpaste.com/543378/
>
> >
> ------------------------------------------------------------------------------
> > Achieve unprecedented app performance and reliability
> > What every C/C++ and Fortran developer should know.
> > Learn how Intel has extended the reach of its next-generation tools
> > to help boost performance applications - inlcuding clusters.
> > http://p.sf.net/sfu/intel-dev2devmay
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
>
>
> --
> Regards,
> Sathishkumar D
>
From: Waleria <wal...@gm...> - 2011年05月17日 12:35:40
Hello all,
I have this code: http://dpaste.com/543369/ (part that generates the chart)
. So i need to show a result in the graph, i have the line 69 (variable
x_sqr) in code, i need to show tthe result of variable in the graph. How can
i do this?
Thank you
Waléria
From: Neal B. <ndb...@gm...> - 2011年05月17日 12:08:30
I have several line graphs on a single plot. I'd like to indicate what is the 
mean of each of them (they are showing cumulative distributions).
Each is a different color.
I tried putting 'mean=xxx' into the legend. That works, but I think it's 
confusing. The legend normally displays independent variables, not results.
I put vertical lines and then text, vertically, just below the x-axis giving the 
mean values. Not very clear.
This is not really a technical question, but one of presentation style. How to 
convey this information?
From: Joachim S. <sa...@gf...> - 2011年05月17日 11:53:21
All,
I have stumbled upon a (for me) unexpected behaviour of axvspan().
import matplotlib.pylab as plt
from numpy import *
x = arange(1000)
y = 0.2*sin(0.02*x)
ax = plt.axes()
plt.axvspan(250, 400, facecolor='g', alpha=0.2)
plt.plot(x,y)
plt.show()
The displayed y range is -0.2 to 1, while from the sine amplitude I 
would have expected -0.2 to 0.2. The expected y range can be obtained by 
omitting the axvspan() call and also if it is called *after* plot().
Is this the desired behaviour, especially in view of the dependence on 
the call order?
__version__ is 1.1.0
Cheers,
Joachim
From: Jae-Joon L. <lee...@gm...> - 2011年05月17日 10:50:42
Attachments: tight_layout.py
Attached is a modified version of Tony's script.
 * no drawing is necessary
 * support subplots that span multiple rows/columns
Please test it and let me know of any problem.
I'm planning to push these functionality into matplolib after some
refactoring (e.g., it would be good to have pyplot.tight_layout).
Regards,
-JJ
On Wed, May 11, 2011 at 8:50 PM, Daniel Mader
<dan...@go...> wrote:
> Hi again,
>
>>> Hi Jae-Loon,
>>>
>>> thanks for your comments! Of course I do agree that a figure layout
>>> should not change in interactive mode. However, I don't see why this
>>> should happen upon a panning action. A different case is when the
>>> label or title font sizes are changed, but I was assuming this is
>>> adjusted prior to the creation of the figure.
>>>
>>
>> Since you said the current design is broken, I thought you want things
>> adjusted *whenever* a figure is updated.
>>
>> So, I guess what you want is some functionality like what Tony's script does?
>> One of the reason that I was not very inclined to Tony's approach is
>> that it only works for subplots (and I guess it only works with
>> subplots with pure n x m grid. Correct me if I'm wrong). But maybe it
>> is better than nothing. I'll consider how things can be improved.
>
> I do sense a match of ideas here :) This is exactly what I am missing!
> It is very good to hear that you are so open to suggestions and
> possible improvements!
>
> It is a great pleasure to work with Scipy/Matplotlib and interact with
> the community!
>
> Best regards,
> Daniel
>
From: Johannes R. <JRa...@gm...> - 2011年05月17日 07:59:01
-------- Original-Nachricht --------
> Datum: 2011年5月16日 11:36:18 -0500
> Von: Benjamin Root <ben...@ou...>
> An: Johannes Radinger <JRa...@gm...>
> CC: mat...@li...
> Betreff: Re: [Matplotlib-users] use matplotlib to produce mathathematical expression only
> On Mon, May 16, 2011 at 11:22 AM, Johannes Radinger
> <JRa...@gm...>wrote:
> 
> >
> > -------- Original-Nachricht --------
> > > Datum: 2011年5月16日 10:59:34 -0500
> > > Von: Benjamin Root <ben...@ou...>
> > > An: Johannes Radinger <JRa...@gm...>
> > > CC: mat...@li...
> > > Betreff: Re: [Matplotlib-users] use matplotlib to produce
> mathathematical
> > expression only
> >
> > > On Mon, May 16, 2011 at 10:21 AM, Johannes Radinger
> > > <JRa...@gm...>wrote:
> > >
> > > >
> > > > -------- Original-Nachricht --------
> > > > > Datum: 2011年5月16日 09:49:24 -0500
> > > > > Von: Benjamin Root <ben...@ou...>
> > > > > An: "mat...@li..." <
> > > > mat...@li...>
> > > > > Betreff: Re: [Matplotlib-users] [SciPy-User] use matplotlib to
> > produce
> > > > mathathematical expression only
> > > >
> > > > > On Monday, May 16, 2011, Johannes Radinger <JRa...@gm...>
> wrote:
> > > > > >
> > > > > > -------- Original-Nachricht --------
> > > > > >> Datum: 2011年5月16日 08:28:49 -0500
> > > > > >> Von: Robert Kern <rob...@gm...>
> > > > > >> An: SciPy Users List <sci...@sc...>
> > > > > >> CC: mat...@li...
> > > > > >> Betreff: Re: [Matplotlib-users] [SciPy-User] use matplotlib to
> > > produce
> > > > > mathathematical expression only
> > > > > >
> > > > > >> On Mon, May 16, 2011 at 08:21, Johannes Radinger <
> > JRa...@gm...>
> > > > > wrote:
> > > > > >> > Hello,
> > > > > >> >
> > > > > >> > I want to produce a eps file of following mathematical
> > > expression:
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
> r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$'
> > > > > >> >
> > > > > >> > is it possible to somehow missuse matplotlib for that to
> produce
> > > > only
> > > > > >> the function without any other plot things? Or is there a
> better
> > > > python
> > > > > >> library within scipy? I don't want to install the complete
> latex
> > > > > libraries just
> > > > > >> for producing this single eps file.
> > > > > >>
> > > > > >> Check out mathtex. It is matplotlib's TeX parsing engine and
> > > renderer
> > > > > >> broken out into a separate library:
> > > > > >>
> > > > > >> http://code.google.com/p/mathtex/
> > > > > >
> > > > > > I also thought about mathtex but don't know how to use my
> > > mathematical
> > > > > expression without a plot of axis etc. any suggestions? I just
> want
> > to
> > > > have
> > > > > the formated math expression as eps and I don't know how to do it,
> > > still
> > > > > after reading in the matplotlib-manual.
> > > > > >
> > > > > > /johannes
> > > > > >
> > > > > >
> > > > > >>
> > > > > >> Also, please send matplotlib questions just to the matplotlib
> > list.
> > > > > >> Thanks.
> > > > > >>
> > > > > >> --
> > > > > >> Robert Kern
> > > > > >>
> > > > > >> "I have come to believe that the whole world is an enigma, a
> > > harmless
> > > > > >> enigma that is made terrible by our own mad attempt to
> interpret
> > it
> > > as
> > > > > >> though it had an underlying truth."
> > > > > >> -- Umberto Eco
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > >> Achieve unprecedented app performance and reliability
> > > > > >> What every C/C++ and Fortran developer should know.
> > > > > >> Learn how Intel has extended the reach of its next-generation
> > tools
> > > > > >> to help boost performance applications - inlcuding clusters.
> > > > > >> http://p.sf.net/sfu/intel-dev2devmay
> > > > > >> _______________________________________________
> > > > > >> Matplotlib-users mailing list
> > > > > >> Mat...@li...
> > > > > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > > > > >
> > > > > > --
> > > > > > NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> > > > > > Jetzt informieren: http://www.gmx.net/de/go/freephone
> > > > > > _______________________________________________
> > > > > > SciPy-User mailing list
> > > > > > Sci...@sc...
> > > > > > http://mail.scipy.org/mailman/listinfo/scipy-user
> > > > > >
> > > > >
> > > > > We have added a new feature to do just that in the development
> > branch,
> > > > > but it should be fairly trivial to do with existing releases of
> > > > > matplotlib. Just create a figure object and use its figtitle to
> hold
> > > > > the expression and then save the figure.
> > > >
> > > > It might be trivial but how to remove the axis/plot then and crop
> the
> > > > extend of the eps?
> > > >
> > > > I tried:
> > > >
> > > > plt.figure()
> > > >
> > >
> >
> plt.title(r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$',
> > > > fontsize=20)
> > > > plt.show()
> > > >
> > > > /j
> > > >
> > > >
> > > Use figtext instead. I did the following and it looked fine to me:
> > >
> > > plt.figure()
> > > plt.figtext(0.1, 0.5,
> > >
> >
> r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$',
> > > fontsize=20)
> > > plt.show()
> > >
> >
> >
> > thats working nearly perfect, I would just need to crop the display
> extend
> > resp. the white space from the eps around...any option/idea?
> >
> >
> > /j
> >
> >
> Try setting bbox_inches='tight' in the call to savefig. With
> bbox_inches='tight', you can then specify the 'pad_inches' kwarg to
> indicate
> how much padding to put around the tight bounding box. This should work,
> however some older version of matplotlib might not check the figure text
> objects for calculating the tightest bounding box. 
Hej,
I tried your suggestion like:
plt.figure()
plt.figtext(0.01, 0.5,r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}+(1-p)*\frac{1}{s1\sqrt{2\pi}}*e^{-\frac{1}{2}*(\frac{x-m}{s1})}$', fontsize=26)
#plt.show()
plt.savefig("testplot.eps", bbox_inches='tight')
but get following error:
 plt.savefig("testplot.eps", bbox_inches='tight')
 File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py", line 363, in savefig
 return fig.savefig(*args, **kwargs)
 File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 1084, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1891, in print_figure
 bbox_inches = self.figure.get_tightbbox(renderer)
 File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 1212, in get_tightbbox
 _bbox = Bbox.union([b for b in bb if b.width!=0 or b.height!=0])
 File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/transforms.py", line 675, in union
 assert(len(bboxes))
AssertionError
For your information:
I work with python 2.6.6 and matplotlib 1.0.1 on Mac OS X 10.6.6
/j
In that case, the way
> that I typically autocrop my eps files is to convert it into a pdf file
> and
> use pdfcrop and then convert it back to eps (assuming you have a standard
> linux install). Here is the chain of commands I typically use on my
> Fedora
> machine:
> 
> epstopdf mathtext.eps --outfile=mathtext.temp.pdf
> pdfcrop --margins '15 2 15 2' --clip mathtext.temp.pdf
> mathtext.cropped.pdf
> pdftops mathtext.cropped.pdf mathtext.cropped.eps
> 
> You can adjust margins to your tastes, and the names of the files are
> fairly
> arbitrary.
> 
> I hope that helps!
> Ben Root
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

Showing 12 results of 12

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