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

Showing 15 results of 15

From: Gary R. <gr...@bi...> - 2005年12月13日 23:14:03
If I understand what you're asking for, note that the pylab text() 
method may do what you want:
from pylab import *
subplot(211)
plot([1,3,2])
ax = subplot(212)
text(0.1, 0.9,
'''the quick brown fox
he quick brown fox
e quick brown fox
quick brown fox''',
verticalalignment='top')
ticklabels = ax.get_xticklabels()+ax.get_xticklines()+\
 ax.get_yticklabels()+ax.get_yticklines()
setp(ticklabels, visible=False)
show()
I think the fontdict parameter of text() should be used to set the font 
to a fixed-width font for your application. I haven't looked at how to 
do this.
Gary R.
Hugo Gamboa wrote:
> Hi to all,
> 
> I'm interessed in having an interactive plotting window where one of the 
> subplots would be for console output.
> For example I would like to print in a subplot (similar to a console 
> output) the several computed values of a selecetd span from some other 
> subplot.
> 
> Does anyone needed a similar feature?
> 
> Thanks in advance for your help.
From: Jiri P. <po...@ph...> - 2005年12月13日 18:55:27
It works perfectly. Thanke you.
How can I set x-axis range? In case of my real data the histogram is not
"centred" and epmty spaces was too huge. In my previous way works:
 axis([ 0.9999*amin(ut), 1.0001*amax(ut), 0, 1.1*amax(n) ])
--
JP
From: <rom...@ya...> - 2005年12月13日 18:20:47
Jiri Polcar wrote:
> 
> But I want to display labels on x-axis's tics as a date human readable
> date (for example "Dec 13").
> 
I adapted this from finance_demo.py. You will probably have to adjust it 
to better suit your needs. It assumes the ut array is sorted.
from pylab import *
from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \
 DayLocator, MONDAY, timezone
import time,datetime
ut = [1127164705, 1127199439, 1127199439, 1127199494, 1127199640, 
1127199651]
date1 = apply(datetime.date,time.localtime(ut[0])[0:3])
date2 = apply(datetime.date,time.localtime(ut[-1])[0:3])
mondays = WeekdayLocator(MONDAY)
weekFormatter = DateFormatter('%b %d') # Eg, Jan 12
alldays = DayLocator()
ax = subplot(111)
ax.xaxis.set_major_locator(mondays)
ax.xaxis.set_minor_locator(alldays)
ax.xaxis.set_major_formatter(weekFormatter)
dates = []
for u in ut:
	year,month,day = time.localtime(u)[0:3]
	dates.append(datetime.date(year,month,day).toordinal())
n, bins, patches = hist( dates, 50 )
setp(patches, 'facecolor', 'g', 'alpha', 0.75)
#axis([ 0.9999*amin(ut), 1.0001*amax(ut), 0, 1.1*amax(n) ])
show()
From: Ryan K. <rya...@gm...> - 2005年12月13日 17:43:47
I believe you can use TeX with any backend provided you have dvipng install=
ed.
On 12/13/05, Ken McIvor <mc...@ii...> wrote:
> On 12/12/05 10:46, Christian Kristukat wrote:
> > I posted this some weeks ago however no solution was found at that time=
.
>
> I'm sorry, I was under the impression that the problem was caused by some=
 kind
> of True-Type font weirdness. Reviewing the exchange, it appears that som=
eone
> else reproduced the segfault and tracked it down to the presence of a
> particular font.
>
> > Since matplotlib 0.84 - now I'm using mpl from cvs - the WXAgg backend
> > crashes with a segfault after calling pylab.show().
>
> Please try disabling the WXAgg accelerator to see if that's where the seg=
fault
> is coming from. Stick the following lines at the beginning of your scrip=
t:
>
> import matplotlib.backends.backend_wxagg
> matplotlib.backends.backend_wxagg._use_accelerator(False)
>
> A short script that consistently reproduces the problem would be helpful,=
 as
> would the output whith verbose.level set to debug-annoying.
>
> > I use mpl through the OO interface in a larger wxPython application and
> > temporarily switched to the WX backend. However it seems that recently =
the tex
> > support was dropped. I get a NotImplementedError when I set rcParams['u=
setex'] =3D
> > True. It would be nice to have at least the tex support back, solving t=
he
> > segfault problem is possibly harder.
>
> To the best of my knowledge, the WX backend has never supported rendering=
 text
> with TeX. My understanding is that you have to be using a backend that
> renders the figure with Agg (e.g. WXAgg) OR the PS backend to get TeX sup=
port.
>
> If the segfault is being cause by the WXAgg accelerator you can switch ba=
ck to
> the WXAgg backend and disable the accelerator, which would allow you to u=
se
> TeX again.
>
> > Btw. I can't find any agg libraries on my system which I could update. =
Are they
> > part of mpl?
>
> The most current version of Agg (2.3) is included with the matplotlib sou=
rce
> distribution. Matplotlib compiles the parts of Agg it needs into each Py=
thon
> extension instead of linking to a shared library, which is probably why y=
ou
> couldn't find any Agg libraries on your system.
>
> Ken
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Charlie M. <cw...@gm...> - 2005年12月13日 17:38:21
I am trying to animate a plot with a circle that will be moved around.
c =3D Circle((0,0))
a =3D gca()
a.add_artist(c)
draw() # This works
c.set_transform(matplotlib.transforms.translation_transform(0.1, 0.1))
draw() # SEGFAULT
How do I update the transform?
Thanks,
- Charlie
From: Ken M. <mc...@ii...> - 2005年12月13日 17:36:15
On 12/12/05 10:46, Christian Kristukat wrote:
> I posted this some weeks ago however no solution was found at that time.
I'm sorry, I was under the impression that the problem was caused by some kind 
of True-Type font weirdness. Reviewing the exchange, it appears that someone 
else reproduced the segfault and tracked it down to the presence of a 
particular font.
> Since matplotlib 0.84 - now I'm using mpl from cvs - the WXAgg backend
> crashes with a segfault after calling pylab.show().
Please try disabling the WXAgg accelerator to see if that's where the segfault 
is coming from. Stick the following lines at the beginning of your script:
	import matplotlib.backends.backend_wxagg
	matplotlib.backends.backend_wxagg._use_accelerator(False)
A short script that consistently reproduces the problem would be helpful, as 
would the output whith verbose.level set to debug-annoying.
> I use mpl through the OO interface in a larger wxPython application and
> temporarily switched to the WX backend. However it seems that recently the tex
> support was dropped. I get a NotImplementedError when I set rcParams['usetex'] =
> True. It would be nice to have at least the tex support back, solving the
> segfault problem is possibly harder.
To the best of my knowledge, the WX backend has never supported rendering text 
with TeX. My understanding is that you have to be using a backend that 
renders the figure with Agg (e.g. WXAgg) OR the PS backend to get TeX support.
If the segfault is being cause by the WXAgg accelerator you can switch back to 
the WXAgg backend and disable the accelerator, which would allow you to use 
TeX again.
> Btw. I can't find any agg libraries on my system which I could update. Are they
> part of mpl?
The most current version of Agg (2.3) is included with the matplotlib source 
distribution. Matplotlib compiles the parts of Agg it needs into each Python 
extension instead of linking to a shared library, which is probably why you 
couldn't find any Agg libraries on your system.
Ken
From: Jiri P. <po...@ph...> - 2005年12月13日 16:05:45
 Hallo,
I have array (ut) of numbers represents unix time (number of seconds
from 1. 1. 1970) of some evenets:
 ...
 1127164705
 1127199439
 1127199439
 1127199494
 1127199640
 1127199651
 ...
I want to plot histogram of this events. I used:
 from pylab import *
 n, bins, patches = hist( ut, 50 )
 setp(patches, 'facecolor', 'g', 'alpha', 0.75)
 axis([ 0.9999*amin(ut), 1.0001*amax(ut), 0, 1.1*amax(n) ])
 show()
But I want to display labels on x-axis's tics as a date human readable
date (for example "Dec 13").
Can anybody help me?
--
JP
From: Hugo G. <hg...@gm...> - 2005年12月13日 14:40:14
Hi to all,
I'm interessed in having an interactive plotting window where one of the
subplots would be for console output.
For example I would like to print in a subplot (similar to a console output=
)
the several computed values of a selecetd span from some other subplot.
Does anyone needed a similar feature?
Thanks in advance for your help.
From: Paul B. <peb...@gm...> - 2005年12月13日 13:24:14
Yes, it would definitely be nice if a better reference is forthcoming. One
with John as lead author, instead of mine. The current situation makes me
feel like a thief.
 -- Paul
On 12/13/05, Darren Dale <dd...@co...> wrote:
>
> Hi Nils,
>
> On Tuesday 13 December 2005 4:51 am, Nils Wagner wrote:
> > Hi all,
> >
> > I found the following message
> >
> > http://www.nabble.com/Publication-reference-to-matplotlib--t331264.html
> >
> > but is there a more general way to cite matplotlib in publications e.g.
> > similar to
> > http://www.scipy.org/documentation/citingscipy.html
>
> John gave this answer a while back:
>
> > Perhaps it would be a good idea for you and others who publish with
> > mpl to cite it in the methods section (eg "figures x, y,and z were
> > generated using matplotlib") with a reference pointing to the web
> > site. Promotion and publicity is always a good thing. Some journals
> > don't allow links in the citations, in which case you could use
> >
> > @InProceedings{BarrettEtal2004,
> > Author =3D {Barrett, P. and Hunter, J.D. and Greenfield, P.},
> > Title =3D {Matplotlib - {A} Portable {Python} Plotting
> Package},
> > BookTitle =3D {Astronomical Data Analysis Software \& Systems
> {XIV}.},
> > year =3D 2004
> > }
>
> I am also working on a couple papers, and was wondering if being mentione=
d
> in
> the acknowledgments would be acceptable. At any rate, I think it would be
> best if the mpl homepage had a "citing matplotlib" link.
>
> Darren
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Paul Barrett, PhD Johns Hopkins University
Assoc. Research Scientist Dept of Physics and Astronomy
Phone: 410-516-5190 Baltimore, MD 21218
From: Darren D. <dd...@co...> - 2005年12月13日 11:24:23
Hi Nils,
On Tuesday 13 December 2005 4:51 am, Nils Wagner wrote:
> Hi all,
>
> I found the following message
>
> http://www.nabble.com/Publication-reference-to-matplotlib--t331264.html
>
> but is there a more general way to cite matplotlib in publications e.g.
> similar to
> http://www.scipy.org/documentation/citingscipy.html
John gave this answer a while back:
> Perhaps it would be a good idea for you and others who publish with
> mpl to cite it in the methods section (eg "figures x, y,and z were
> generated using matplotlib") with a reference pointing to the web 
> site. Promotion and publicity is always a good thing. Some journals
> don't allow links in the citations, in which case you could use
> 
> @InProceedings{BarrettEtal2004,
> Author = {Barrett, P. and Hunter, J.D. and Greenfield, P.},
> Title = {Matplotlib - {A} Portable {Python} Plotting Package},
> BookTitle = {Astronomical Data Analysis Software \& Systems {XIV}.},
> year = 2004
> }
I am also working on a couple papers, and was wondering if being mentioned in 
the acknowledgments would be acceptable. At any rate, I think it would be 
best if the mpl homepage had a "citing matplotlib" link.
Darren
From: Nils W. <nw...@me...> - 2005年12月13日 09:52:06
Hi all,
I found the following message
http://www.nabble.com/Publication-reference-to-matplotlib--t331264.html
but is there a more general way to cite matplotlib in publications e.g.
similar to
http://www.scipy.org/documentation/citingscipy.html
Nils
 
From: Andrea R. <ari...@pi...> - 2005年12月13日 08:55:57
Thanks to both Jeff and John for your help. Just a further question: 
what if I want to do contour plot with dashed lines (or any other 
symbol)?
contour(x, y, nu.transpose(z), linestyle = '-', colors = 'r')
or
contour(x, y, nu.transpose(z), colors = 'r-')
don't work.
Thanks,
 Andrea
On Dec 13, 2005, at 03:43 , John Hunter wrote:
>>>>>> "Jeff" == Jeff Whitaker <js...@fa...> writes:
>
> Jeff> fig.set_figsize_inches((8,8)) # default is (8,6)
>
> Jeff> You might also have to use the set_xlim and set_ylim axes
> Jeff> methods to make sure the axis limits are set to be the same.
>
> You probably also want to look at the "set_aspect" method of the axes,
> which has received a lot of attention from mark Bakkar. In
> particular,
>
> ax = subplot(111, aspect='equal')
>
> should help.
>
> With an existing axes instance,
>
> ax.set_aspect('equal').
>
> Here is the docstring, since the web site is not updated to the
> current release yet.,
>
> def set_aspect 
> (self,aspect='normal',fixLimits=False,alignment='center'):
> """
> Set aspect to 'normal' or 'equal'
>
> 'normal' means matplotlib determines aspect ratio
>
> 'equal' means scale on x and y axes will be set equal such
> that circle looks like circle
>
> In the future we may want to add a number as input to have
> a certain aspect ratio,
>
> such as vertical scale exagerrated by 2.
>
> fixLimits: False means data limits will be changed, but height
> and widths of axes preserved. True means height or
> width will be changed, but data limits preserved
>
> alignment is 'center' or 'lowerleft', only used when fixLimits
> is True
>
> ACCEPTS: str, boolean, str
> """
From: John H. <jdh...@ac...> - 2005年12月13日 02:50:05
>>>>> "Jeff" == Jeff Whitaker <js...@fa...> writes:
 Jeff> fig.set_figsize_inches((8,8)) # default is (8,6)
 Jeff> You might also have to use the set_xlim and set_ylim axes
 Jeff> methods to make sure the axis limits are set to be the same.
You probably also want to look at the "set_aspect" method of the axes,
which has received a lot of attention from mark Bakkar. In
particular, 
ax = subplot(111, aspect='equal') 
should help.
With an existing axes instance, 
ax.set_aspect('equal').
Here is the docstring, since the web site is not updated to the
current release yet.,
 def set_aspect(self,aspect='normal',fixLimits=False,alignment='center'):
 """
 Set aspect to 'normal' or 'equal'
 'normal' means matplotlib determines aspect ratio
 'equal' means scale on x and y axes will be set equal such
 that circle looks like circle
 In the future we may want to add a number as input to have
 a certain aspect ratio,
 such as vertical scale exagerrated by 2.
 fixLimits: False means data limits will be changed, but height
 and widths of axes preserved. True means height or
 width will be changed, but data limits preserved
 alignment is 'center' or 'lowerleft', only used when fixLimits
 is True
 ACCEPTS: str, boolean, str
 """
From: John H. <jdh...@ac...> - 2005年12月13日 02:44:31
>>>>> "Steve" == Steve Miller <ste...@jh...> writes:
 Steve> Has anyone worked with quotes_historical_yahoo module
 Steve> enough to know if the 7th attribute, adjusted price, is
 Steve> available? Adjusted price is sort of a total return figure
 Steve> -- price adjusted for splits and dividends and is actually
 Steve> the critical number to consider for performance over long
 Steve> periods of time. Finance.quothist in Perl provides this
 Steve> attribute as an option.
There is support for this in CVS -- you can pass the "adjusted" kwarg
to the function to get the adjusted price. There is also the asobject
kwarg, which when true, will return an object with the various
attributes (open, close, high, low, date, volume) as array
attributes. This is a little more convenient, especially when working
with multiple instruments. Eg
 sp = finance.quotes_historical_yahoo(
 '^GSPC', d1, d2, asobject=True, adjusted=True)
 returns = (sp.open[1:] - sp.open[:-1])/sp.open[1:]
 [n,bins,patches] = hist(returns, 100)
 mu = mean(returns)
 sigma = std(returns)
 x = normpdf(bins, mu, sigma)
 plot(bins, x, color='red', lw=2)
JDH
From: Tony R. <ton...@gm...> - 2005年12月13日 02:34:56
That did the trick... Thank you very much!
Tony
Peter Groszkowski wrote:
>
>>
>> Does anyone know of a way to create a legend outside the bounds of 
>> the graph? I have a stacked area chart that doesn't have any spare 
>> room. When matplotlib draws the legend it obscures the data! I looked 
>> through the available documentation and didn't see any way around 
>> this. Does anyone have any tricks that might work?
>>
>
> checkout figlegend_demo.py in the matplotlib examples...
>
> more trivial example:
>
> #!/usr/bin/env python
> from pylab import *
> x=arange(0, 6, 0.1)
> y=sin(x)
> figure(figsize=(11,6))
> axes([0.075, 0.10, 0.55, 0.78])
> lines=plot(x,y)
> figlegend((lines,), ("i'm outside!",), 'upper right')
> show()
>
> can play with axes/figsize if you've got long names
>
> cheers,
>

Showing 15 results of 15

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