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


Showing results of 28

1 2 > >> (Page 1 of 2)
From: Carlos G. <car...@gm...> - 2010年09月23日 20:24:18
many thanks. very useful info.
Carlos
On Thu, Sep 23, 2010 at 17:03, John Hunter <jd...@gm...> wrote:
> On Thu, Sep 23, 2010 at 2:33 PM, Chloe Lewis <ch...@be...> wrote:
>> Well, I had my bib program open, so here are a couple formats:
>
> Thanks for posting these. I added this to the FAQ:
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html#cite-matplotlib
>
> JDH
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721
________________
Can’t stop the signal.
From: John H. <jd...@gm...> - 2010年09月23日 20:03:54
On Thu, Sep 23, 2010 at 2:33 PM, Chloe Lewis <ch...@be...> wrote:
> Well, I had my bib program open, so here are a couple formats:
Thanks for posting these. I added this to the FAQ:
 http://matplotlib.sourceforge.net/faq/howto_faq.html#cite-matplotlib
JDH
From: Chloe L. <ch...@be...> - 2010年09月23日 19:33:52
Well, I had my bib program open, so here are a couple formats:
On Sep 22, 2010, at 22 Sep, 1:18 PM, Benjamin Root wrote:
> On Wed, Sep 22, 2010 at 3:13 PM, Jason Grout <jas...@cr... 
> > wrote:
> On 09/22/2010 08:59 AM, John Hunter wrote:
> > On Wed, Sep 22, 2010 at 8:45 AM, Bala subramanian
> > <bal...@gm...> wrote:
> >> Friends,
> >> I have mentioned in my research manuscript that plots were 
> generated by
> >> 'matplotlib package'. I dnt find the related reference of mpl. 
> Kindly tell
> >> me how can i site mpl.
> > You can certainly reference the website, but if you want to refer 
> to a
> > published paper, I suggest
> >
> > Matplotlib: A 2D Graphics Environment
> > Source: Computing in Science and Engineering archive
> > Volume 9 , Issue 3 (May 2007)
> > Pages: 90-95
> > Year of Publication: 2007
> > ISSN:1521-9615
> > Author:John D. Hunter
> > Publisher : IEEE Educational Activities Department 
> Piscataway, NJ, USA
> >
> > and/or the conference abstract at
> > http://adsabs.harvard.edu/abs/2005ASPC..347...91B
>
> Could this be put up on the website somewhere in a easily-found place?
> Maybe a short sentence and link in the bar on the right under "Other
> stuff"? Something like "To cite matplotlib in a paper, use <a
> href='link to wiki page with that citation, preferably in several
> formats like bibtex'> this reference</a>." or something.
>
> Thanks,
>
> Jason
>
>
> +1...
>
> This would help by providing a consistent way of citing matplotlib. 
> Without this, different authors may reference matplotlib different 
> ways, thereby diluting the impact of the above reference. Plus, it 
> always annoyed me to try and figure out how to cite things like 
> matplotlib or various data sources.
>
> Ben Root
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chloe Lewis
Ecosystem Sciences, Policy and Management, UC Berkeley
137 Mulford Hall
Berkeley, CA 94720-3114
http://nature.berkeley.edu/~chlewis
From: Michael D. <md...@st...> - 2010年09月23日 19:13:54
I should also add that matplotlib doesn't have any advanced text layout 
algorithms (such as what would be found in Pango), so Hebrew and Arabic 
are likely to be backwards and wrong.
Mike
On 09/23/2010 03:07 PM, Michael Droettboom wrote:
> You may need to use a font with a more complete character set, such as 
> DejaVu.
>
> Mike
>
> On 09/23/2010 02:56 PM, Oz Nahum wrote:
>> Hi Everyone,
>> Not really related to my every day work, but I was asking myself how 
>> to put non latin letters, like arabic or hebrew on plots.
>>
>> I found a way to put german umlauts and ß but this is only a very 
>> partial solution. It would be cool to know how to over come this.
>>
>> My code to work with umlauts is:
>>
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>>
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> def format(x, pos=None):
>> if x == 0.0:
>> exp = 0
>> else:
>> exp = int(np.log10(np.abs(x)))
>> mant = x / 10**exp
>> return '%.1fE%+d' % (mant, exp)
>>
>> f = plt.figure()
>> ax = f.add_subplot(111)
>> data = np.array([1,2,3,4,5]) / 100.
>> ax.plot(data, np.arange(len(data)))
>>
>> ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
>> ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
>> ax.text(0.03,0.5,"Umlauts äüöß"+ u"\u00e4")
>> plt.show()
>>
>> If I include arabic or hebrew letters I get Bricks displays.
>>
>> Thanks in advance,
>>
>> Oz
>>
>> -- 
>> Oz Nahum
>> Graduate Student
>> Zentrum für Angewandte Geologie
>> Universität Tübingen
>>
>> ---
>>
>> Imagine there's no countries
>> it isn't hard to do
>> Nothing to kill or die for
>> And no religion too
>> Imagine all the people
>> Living life in peace
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
>> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada
>> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in marketing
>> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
>> http://p.sf.net/sfu/nokia-dev2dev
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
>
>
> -- 
> Michael Droettboom
> Science Software Branch
> Space Telescope Science Institute
> Baltimore, Maryland, USA
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada
> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Michael D. <md...@st...> - 2010年09月23日 19:07:41
You may need to use a font with a more complete character set, such as 
DejaVu.
Mike
On 09/23/2010 02:56 PM, Oz Nahum wrote:
> Hi Everyone,
> Not really related to my every day work, but I was asking myself how 
> to put non latin letters, like arabic or hebrew on plots.
>
> I found a way to put german umlauts and ß but this is only a very 
> partial solution. It would be cool to know how to over come this.
>
> My code to work with umlauts is:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> def format(x, pos=None):
> if x == 0.0:
> exp = 0
> else:
> exp = int(np.log10(np.abs(x)))
> mant = x / 10**exp
> return '%.1fE%+d' % (mant, exp)
>
> f = plt.figure()
> ax = f.add_subplot(111)
> data = np.array([1,2,3,4,5]) / 100.
> ax.plot(data, np.arange(len(data)))
>
> ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
> ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
> ax.text(0.03,0.5,"Umlauts äüöß"+ u"\u00e4")
> plt.show()
>
> If I include arabic or hebrew letters I get Bricks displays.
>
> Thanks in advance,
>
> Oz
>
> -- 
> Oz Nahum
> Graduate Student
> Zentrum für Angewandte Geologie
> Universität Tübingen
>
> ---
>
> Imagine there's no countries
> it isn't hard to do
> Nothing to kill or die for
> And no religion too
> Imagine all the people
> Living life in peace
>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada
> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Oz N. <na...@gm...> - 2010年09月23日 18:57:02
Hi Everyone,
Not really related to my every day work, but I was asking myself how to put
non latin letters, like arabic or hebrew on plots.
I found a way to put german umlauts and ß but this is only a very partial
solution. It would be cool to know how to over come this.
My code to work with umlauts is:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
def format(x, pos=None):
 if x == 0.0:
 exp = 0
 else:
 exp = int(np.log10(np.abs(x)))
 mant = x / 10**exp
 return '%.1fE%+d' % (mant, exp)
f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))
ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
ax.yaxis.set_major_formatter(plt.FuncFormatter(format))
ax.text(0.03,0.5,"Umlauts äüöß"+ u"\u00e4")
plt.show()
If I include arabic or hebrew letters I get Bricks displays.
Thanks in advance,
Oz
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Stan W. <sta...@nr...> - 2010年09月23日 18:20:30
From: Jeremy Lewi [mailto:jl...@in...] 
Sent: Friday, September 17, 2010 17:38
 
Is there a way to get the size of the bounding box for the axes which includes
the axes labels and tick marks? It looks like Axes.get_position/set_position
refers to the inner position (i.e the actual plot area).
Perhaps you could use the get_tightbbox() method possessed by Figure and Axes
instances, although you need to tell it what renderer to use. If you've
already drawn the figure in a GUI window, the method employed by
FigureCanvasBase.print_figure in backend_bases.py might work:
fig = plt.gcf()
bbox = fig.get_tightbbox(fig._cachedRenderer)
You can then get the measurements using such properties and methods as these:
left, bottom, width, height = bbox.bounds
left, bottom, right, top = bbox.get_points().flatten()
From: Oz N. <na...@gm...> - 2010年09月23日 16:58:32
Hi Ryan,
Thanks again,
Well your solution is also working.
I get very similar results with
class NiceSciFormatter(Formatter):
 def __call__(self, x, pos=None):
 a="%1.1E" % x
 a=a[:5]+a[-1]
 return a
It seems though that your solution enables more fine tuning !
Cheers,
Oz
On Thu, Sep 23, 2010 at 5:10 PM, Ryan May <rm...@gm...> wrote:
> On Thu, Sep 23, 2010 at 8:52 AM, Oz Nahum <na...@gm...> wrote:
> > Hi Ryan,
> >
> > Thanks for your answer. However, I don't understand from the existing
> > documentation how to use tickers.
> >
> > In the past I used the following method:
> > class SciFormatter(Formatter):
> > def __call__(self, x, pos=None):
> > return "%1.1e" % x
> >
> >
> > axs.yaxis.set_major_formatter(SciFormatter())
> >
> > This still does not allow me to get read of the zeros that matplotlib
> > coherces .
> >
> > I would like to manipulate the strings of the tick labels directly. I
> know
> > it's not ideal, but I it should work.
> >
> > If I could access the label "1.1E+01", I could tell python just to take
> > label[:-2] and glue it to label[-1], which will give me
> > "1.1E+1"
> >
> > I would be greatful if someone showed me how to access that string.
>
> Why not just format the number yourself?
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> def format(x, pos=None):
> if x == 0.0:
> exp = 0
> else:
> exp = int(np.log10(np.abs(x)))
> mant = x / 10**exp
> return '%.2fE%+d' % (mant, exp)
>
> f = plt.figure()
> ax = f.add_subplot(111)
> data = np.array([1,2,3,4,5]) / 100.
> ax.plot(data, np.arange(len(data)))
>
> ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
>
> plt.show()
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: David T. <dav...@gm...> - 2010年09月23日 16:21:44
> On Wed, Sep 15, 2010 at 3:03 AM, David Trémouilles <dav...@gm...
> <mailto:dav...@gm...>> wrote:
>
> Hello,
>
> Does anybody know if matplotlib work with pyside ?
> If it does how to use matplotib with pyside ?
>
> Thanks,
>
> David
>
>
> David,
>
> I am not familiar with PySide, so I looked it up. Please correct me if
> I am wrong, but it appears to be an alternative to PyQt for licensing
> reasons, and the FAQ says that it is API compatible. On the python side
> of matplotlib, I wonder if using PySide would be as simple as just
> replacing all of the "import PyQt" or "import PyQt4" with "import
> PySide" (and all the "from PyQt import ...").
>
> Does PySide still use the same compiled Qt libraries that PyQt uses? If
> so, then I don't *think* you need to recompile the Qt backends, but I am
> not entirely sure.
>
> Good luck!
> Ben Root
>
Hi Ben,
I did try to roughly replace PyQt4 import by PySide import
in my installed matplotlib but pyplot.plot function led to a seg fault...
(PyQt and PySide where indeed compiled with the same Qt lib)
I'm not skilled enough to go further on...
Thanks for your help,
David
From: Jason G. <jas...@cr...> - 2010年09月23日 16:18:58
On 9/22/10 2:55 PM, Lütteke Felix wrote:
> Hello,
>
>
>
> is there a possibility to order several 3dplots, if all are plotted
> in the same figure. If I execute the code below, the higher values
> (blue) are covered by the lower (yellow) ones, which seems quite
> unlogical to me (see attached image). Any help if greatly appreciated
> - after having searched for a solution quite a few hours...
>
>
There is no cutting up of objects and ordering them based on distance to 
the viewer, if that's what you're asking. I see an experiment on github 
that starts to implement that sort of thing, though:
http://github.com/astraw/matplotlib/network/members
Thanks,
Jason
From: David T. <dav...@gm...> - 2010年09月23日 15:52:22
Wonderful !
This does indeed solve my issue.
Many many thanks,
David
Le 23/09/10 17:35, Ryan May a écrit :
> On Thu, Sep 23, 2010 at 9:16 AM, David Trémouilles<dav...@gm...> wrote:
>> OK, was able to narrow thinks down:
>> actually it looks like
>> figure.canvas.mpl_connect('pick_event', function)
>> does not connect the "function" if it is a class method (...?)
>> In attachment you will find two files illustrating this:
>> buggy_pick.py and buggy_pick2.py
>> Both work nicely with matplotlib 0.93
>> With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py does
>> work.
>> The only difference is in the PickFig class...
>>
>> Is it really a bug or I'm doing something wrong ?
>>
>> Any workaround would be welcome.
>
> Technically, you're doing something sort of wrong, though it's very
> subtle. And it just so happens that the way the code for callbacks was
> reworked that this even showed up.
> In this code:
>
> class TestFig(MatplotlibFig):
> def __init__(self, parent=None):
> MatplotlibFig.__init__(self, parent)
> PickFig(self.figure)
>
> You create a PickFig, but since you don't assign it to anything, it
> gets garbage collected and (eventually) removed from the callbacks.
> Previously, the callback registry would have a reference to the
> callbacks, which would have kept PickFig alive. This was changed to
> eliminate some resource leaks. The fix is simple, just save the
> PickFig as a member of TestFig:
>
> self.pf = PickFig(self.figure)
>
> That fixes the problem for me.
>
> Ryan
>
From: Ryan M. <rm...@gm...> - 2010年09月23日 15:36:26
On Thu, Sep 23, 2010 at 9:16 AM, David Trémouilles <dav...@gm...> wrote:
> OK, was able to narrow thinks down:
> actually it looks like
> figure.canvas.mpl_connect('pick_event', function)
> does not connect the "function" if it is a class method (...?)
> In attachment you will find two files illustrating this:
> buggy_pick.py and buggy_pick2.py
> Both work nicely with matplotlib 0.93
> With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py does
> work.
> The only difference is in the PickFig class...
>
> Is it really a bug or I'm doing something wrong ?
>
> Any workaround would be welcome.
Technically, you're doing something sort of wrong, though it's very
subtle. And it just so happens that the way the code for callbacks was
reworked that this even showed up.
In this code:
class TestFig(MatplotlibFig):
 def __init__(self, parent=None):
 MatplotlibFig.__init__(self, parent)
 PickFig(self.figure)
You create a PickFig, but since you don't assign it to anything, it
gets garbage collected and (eventually) removed from the callbacks.
Previously, the callback registry would have a reference to the
callbacks, which would have kept PickFig alive. This was changed to
eliminate some resource leaks. The fix is simple, just save the
PickFig as a member of TestFig:
self.pf = PickFig(self.figure)
That fixes the problem for me.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Christopher B. <Chr...@no...> - 2010年09月23日 15:33:51
Justin Park wrote:
> Hello,
> 
> I am using Mac 10.5.8.
> 
> I have been trying to install Matplotlib, and succeeded to do so.
How did you install it?
What python are you using?
-Chris
> But when I try to import matplotlib.pyplot, I got the following error:
> 
>>>> import matplotlib.pyplot
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/pyplot.py",
> line 23, in <module>
> from matplotlib.figure import Figure, figaspect
> File
> "/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/figure.py",
> line 16, in <module>
> import artist
> File
> "/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/artist.py",
> line 6, in <module>
> from transforms import Bbox, IdentityTransform, TransformedBbox,
> TransformedPath
> File
> "/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/transforms.py",
> line 34, in <module>
> from matplotlib._path import affine_transform
> ImportError: No module named _path
> 
> Could you please let me know how I can fix this problem?
> I tried several ways of reinstalling it(after cleaning as described in
> many web-sites), but all the ways returned the same error.
> 
> Thanks,
> Justin.
> 
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> 10ドル million total in prizes - 4ドルM cash, 500 devices, nearly 6ドルM in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Ryan M. <rm...@gm...> - 2010年09月23日 15:11:05
On Thu, Sep 23, 2010 at 8:52 AM, Oz Nahum <na...@gm...> wrote:
> Hi Ryan,
>
> Thanks for your answer. However, I don't understand from the existing
> documentation how to use tickers.
>
> In the past I used the following method:
> class SciFormatter(Formatter):
>   def __call__(self, x, pos=None):
>     return "%1.1e" % x
>
>
> axs.yaxis.set_major_formatter(SciFormatter())
>
> This still does not allow me to get read of the zeros that matplotlib
> coherces .
>
> I would like to manipulate the strings of the tick labels directly. I know
> it's not ideal, but I it should work.
>
> If I could access the label "1.1E+01", I could tell python just to take
> label[:-2] and glue it to label[-1], which will give me
> "1.1E+1"
>
> I would be greatful if someone showed me how to access that string.
Why not just format the number yourself?
import matplotlib.pyplot as plt
import numpy as np
def format(x, pos=None):
 if x == 0.0:
 exp = 0
 else:
 exp = int(np.log10(np.abs(x)))
 mant = x / 10**exp
 return '%.2fE%+d' % (mant, exp)
f = plt.figure()
ax = f.add_subplot(111)
data = np.array([1,2,3,4,5]) / 100.
ax.plot(data, np.arange(len(data)))
ax.xaxis.set_major_formatter(plt.FuncFormatter(format))
plt.show()
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Oz N. <na...@gm...> - 2010年09月23日 15:09:24
Hi Every, Hi Ryan
I finally solved this issue, which bothered me very long.
I managed to make a nicer scientific formatting on the xticks !
from pylab import *
import numpy as N
from matplotlib.ticker import Formatter,FuncFormatter
import os
#class to produce scientific format numbering
class SciFormatter(Formatter):
 def __call__(self, x, pos=None):
 return "%1.e" % x
class NiceSciFormatter(Formatter):
 def __call__(self, x, pos=None):
 a="%1.1E" % x
 a=a[:5]+a[-1]
 return a
fig=figure()
ax=fig.add_subplot(111)
y=[.0001,.0002,.0003,.0004,.0005]
x=[1,2,3,4,5]
ax.plot(x,y)
ax.yaxis.set_major_formatter(NiceSciFormatter())
show()
Cheers ,
Oz
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Justin P. <jus...@gm...> - 2010年09月23日 14:28:58
Hello,
I am using Mac 10.5.8.
I have been trying to install Matplotlib, and succeeded to do so.
But when I try to import matplotlib.pyplot, I got the following error:
>>> import matplotlib.pyplot
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/pyplot.py",
line 23, in <module>
 from matplotlib.figure import Figure, figaspect
 File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/figure.py",
line 16, in <module>
 import artist
 File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/artist.py",
line 6, in <module>
 from transforms import Bbox, IdentityTransform, TransformedBbox,
TransformedPath
 File
"/Users/hp6/RESEARCH/TOOL/pythons/matplotlib/lib/matplotlib/transforms.py",
line 34, in <module>
 from matplotlib._path import affine_transform
ImportError: No module named _path
Could you please let me know how I can fix this problem?
I tried several ways of reinstalling it(after cleaning as described in
many web-sites), but all the ways returned the same error.
Thanks,
Justin.
From: David T. <dav...@gm...> - 2010年09月23日 14:17:03
OK, was able to narrow thinks down:
actually it looks like
figure.canvas.mpl_connect('pick_event', function)
does not connect the "function" if it is a class method (...?)
In attachment you will find two files illustrating this:
buggy_pick.py and buggy_pick2.py
Both work nicely with matplotlib 0.93
With matplotlib 1.0 buggy_pick.py does not work while buggy_pick2.py 
does work.
The only difference is in the PickFig class...
Is it really a bug or I'm doing something wrong ?
Any workaround would be welcome.
Thx,
David
PS. Is it better to discuss this on users or devel list ?
Le 23/09/10 15:42, Ryan May a écrit :
> On Thu, Sep 23, 2010 at 3:20 AM, David Trémouilles<dav...@gm...> wrote:
>> Hello,
>>
>> I've just updated matplotlib to 1.0 svn version from 0.93.
>> My pyqt4 app use the pick event. Cliking on a point in the graph
>> triggers an event but with matplotlib 1.0 it does not anymore while
>> it was working fine with 0.93.
>> Any idea/help on where I should look for ?
>
> Not without a better idea of what you're doing. I *can* say that both
> picking examples work fine for me with the Qt4Agg backend. Can you
> create a complete, minimal example that replicates the problem you're
> seeing? Without that, I'd just be guessing blindly.
>
> Ryan
>
From: Oz N. <na...@gm...> - 2010年09月23日 13:52:42
Hi Ryan,
Thanks for your answer. However, I don't understand from the existing
documentation how to use tickers.
In the past I used the following method:
class SciFormatter(Formatter):
 def __call__(self, x, pos=None):
 return "%1.1e" % x
axs.yaxis.set_major_formatter(SciFormatter())
This still does not allow me to get read of the zeros that matplotlib
coherces .
I would like to manipulate the strings of the tick labels directly. I know
it's not ideal, but I it should work.
If I could access the label "1.1E+01", I could tell python just to take
label[:-2] and glue it to label[-1], which will give me
"1.1E+1"
I would be greatful if someone showed me how to access that string.
Cheers,
Oz
On Thu, Sep 23, 2010 at 3:37 PM, Ryan May <rm...@gm...> wrote:
> On Thu, Sep 23, 2010 at 3:49 AM, Oz Nahum <na...@gm...> wrote:
> > Hi Everyone,
> >
> > I don't like the default scientific formatting in matplotlib, IMHO the
> > format of having a zero after the exponent is a waste of space in my
> opinion
> > ...
> > What I mean is that mpl is writing zero as:
> > 0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3,
> which
> > take less space and looks better (again, imho).
>
> <SNIP>
>
> >
> > As can be seen, the text string is empty before calling show, which is
> > forcing me to show the image . Is there a way to access these labales
> with
> > out calling show() ?
>
> What you want is to set a custom formatter:
>
> http://matplotlib.sourceforge.net/api/ticker_api.html
>
> import matplotlib.pyplot as plt
> f = plt.figure()
> ax = f.add_subplot(111)
> ax.plot([1,2,3,4,5])
> # Formats ticks on the xaxis with the %.2g format string
> ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.2g'))
> plt.show()
>
> If you can't get what you want using a format string, you can write a
> function that does what you want can create a formatter from that
> using FuncFormatter.
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: Ryan M. <rm...@gm...> - 2010年09月23日 13:43:10
On Thu, Sep 23, 2010 at 3:20 AM, David Trémouilles <dav...@gm...> wrote:
> Hello,
>
> I've just updated matplotlib to 1.0 svn version from 0.93.
> My pyqt4 app use the pick event. Cliking on a point in the graph
> triggers an event but with matplotlib 1.0 it does not anymore while
> it was working fine with 0.93.
> Any idea/help on where I should look for ?
Not without a better idea of what you're doing. I *can* say that both
picking examples work fine for me with the Qt4Agg backend. Can you
create a complete, minimal example that replicates the problem you're
seeing? Without that, I'd just be guessing blindly.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Ryan M. <rm...@gm...> - 2010年09月23日 13:37:42
On Thu, Sep 23, 2010 at 3:49 AM, Oz Nahum <na...@gm...> wrote:
> Hi Everyone,
>
> I don't like the default scientific formatting in matplotlib, IMHO the
> format of having a zero after the exponent is a waste of space in my opinion
> ...
> What I mean is that mpl is writing zero as:
> 0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3, which
> take less space and looks better (again, imho).
<SNIP>
>
> As can be seen, the text string is empty before calling show, which is
> forcing me to show the image . Is there a way to access these labales with
> out calling show() ?
What you want is to set a custom formatter:
http://matplotlib.sourceforge.net/api/ticker_api.html
import matplotlib.pyplot as plt
f = plt.figure()
ax = f.add_subplot(111)
ax.plot([1,2,3,4,5])
# Formats ticks on the xaxis with the %.2g format string
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.2g'))
plt.show()
If you can't get what you want using a format string, you can write a
function that does what you want can create a formatter from that
using FuncFormatter.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Aman T. <ama...@gm...> - 2010年09月23日 12:52:42
Hi David,
I'm using the pick event in wx (matplotlib 1.0) without any issues. Could
you please post some sample code? Have you tried to see if
legend.draggable() works? If so, the pick event is likely not an issue.
-Aman
On Thu, Sep 23, 2010 at 4:20 AM, David Trémouilles <dav...@gm...>wrote:
> Hello,
>
> I've just updated matplotlib to 1.0 svn version from 0.93.
> My pyqt4 app use the pick event. Cliking on a point in the graph
> triggers an event but with matplotlib 1.0 it does not anymore while
> it was working fine with 0.93.
> Any idea/help on where I should look for ?
>
> Thanks in advance,
>
> David
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jd...@gm...> - 2010年09月23日 12:48:13
On Wed, Sep 22, 2010 at 8:31 PM, C M <cmp...@gm...> wrote:
> Until a more permanent solution is figured out, can anyone recommend
> any workarounds, even if they are a little clunky? I'm embedding mpl
> plots in wxPython and am also finding this issue suboptimal.
Change your subplots adjust parameters to make the default bottom,
left, wspace and hspace wider. This will reduce the chance of
overlaps.
http://matplotlib.sourceforge.net/search.html?q=subplots_adjust
The defaults can be changed in your rc file
 http://matplotlib.sourceforge.net/users/customizing.html
See also these recipes on the FAQ to automatically choose boundaries
 http://matplotlib.sourceforge.net/faq/howto_faq.html#move-the-edge-of-an-axes-to-make-room-for-tick-labels
 http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels
Automatic layout to avoid overlap is not an easy problem -- Michael
Droetboom worked on it for a while but didn't get to a satisfactory
point. So far our philosophy has been : make it easy to customize
rather than do it automatically. I realize this is not always a good
approach, especially in automated figure generators where you don't
have access to the data ahead of time.
JDH
From: Oz N. <na...@gm...> - 2010年09月23日 08:49:36
Hi Everyone,
I don't like the default scientific formatting in matplotlib, IMHO the
format of having a zero after the exponent is a waste of space in my opinion
...
What I mean is that mpl is writing zero as:
0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3, which
take less space and looks better (again, imho).
In any case, I would like to access the strings of the yticklables in my
plots and I discovered I can do the following:
setp(axs[2].set_yticklabels(['0.0','2.0E-4','4.0E-4','6.0E-4','8.0E-4','1.0E-3','1.2E-3']))
Which works, but forces me to first look at the output and the redraw
everything with manually feeding the values.
if there is a way to loop on this text values before plotting I will be
happy to know.
I tried doing this:
In [1]: from pylab import *
In [2]: f=figure()
In [3]: ax=f.add_subplot()
In [4]: ax.plot([1,2,3,4,5])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/oz/<ipython console> in <module>()
AttributeError: 'NoneType' object has no attribute 'plot'
In [5]: ax=f.add_subplot(111)
In [6]: ax.plot([1,2,3,4,5])
Out[6]: [<matplotlib.lines.Line2D object at 0x95ecdcc>]
In [7]: a=ax.get_xticklabels()
In [8]: a[0].get_text()
Out[8]: ''
In [9]: draw()
In [10]: a[0].get_text()
In [10]: a[0].get_text()
Out[10]: ''
In [11]: show()
....
KeyboardInterrupt:
In [12]: a[0].get_text()
Out[12]: u'0.0
As can be seen, the text string is empty before calling show, which is
forcing me to show the image . Is there a way to access these labales with
out calling show() ?
Thanks in advance,
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: David T. <dav...@gm...> - 2010年09月23日 08:20:26
Hello,
 I've just updated matplotlib to 1.0 svn version from 0.93.
My pyqt4 app use the pick event. Cliking on a point in the graph
triggers an event but with matplotlib 1.0 it does not anymore while
it was working fine with 0.93.
Any idea/help on where I should look for ?
Thanks in advance,
David
From: Peter H. <ph...@bw...> - 2010年09月23日 03:43:04
OK, I spoke a little too soon last time. I reinstalled it tonight and looked a little closer. Essentially all of the regular files under
.../site-packages/matplotlib/... and its subdirectories have permissions similar to
-rw--w----
not just the mpl-data subdir, and I guess they should be something like
-rw-r--r--
Also, I looked into why I couldn't chmod; apparently our "labadmin" account wasn't given permission to chmod or chown anybody else's files, so I need to talk to our IT guy about that.
peter
 Ben wrote:
>This might actually be the closest explanation and diagnosis that I have seen on this issue. However, I >am curious why the labadmin account could not chmod those files? Also, how do the permissions of >those files compare to the permissions of everything else? Why is it that the behavior is different for >those files compared to the python modules themselves?
>Ben Root

Showing results of 28

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