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


Showing 10 results of 10

From: Jorge S. <jor...@ya...> - 2011年06月10日 18:08:59
Benjamin Root <ben.root@...> writes:
> Jorges,
> iPython can do some special things with matplotlib's interactivity when 
> invoked in certain ways (hence why it was called "interactive" python). I 
> don't know the particulars of what ipython does, but this does not surprise 
> me. Does everything work as you expect in interactive mode through regular 
> python?
> Ben Root
Well, I don't know what's the expected behavior. If I set interactive to no,
then my script works OK in python (and also in ipython, btw). If I set it to
yes, though, the figures appear and are closed as soon as the script ends in
python, and they stay open but with the custom events non-functional in ipython.
That might be the expected behavior, and I started to see this behavior because
something changed in ipython (maybe the default was non-interactive before, or
something more complicated in the way ipython deals with matplotlib). I searched
the documentation about details of how interactive works and/or any caveats, but
didn't find much, and hence the question here.
For now I'll turn off interactive, as that seems to make my scripts work as they
did before.
Cheers,
jorges
From: calmar c. <ma...@ca...> - 2011年06月10日 17:50:38
On Fri, Jun 10, 2011 at 11:10:02AM -0500, Benjamin Root wrote:
> 
> Why not just use an array of datetime.timedelta objects?� I believe
> matplotlib already supports this, does automatic formatting and even
> allows you to easily modify how the formatting is done.
I was not able to figure out how it would support them
(datetime.timedelta objects). datetime.datetime objects only as
far as I saw.
So I would have to create some artificial datetime + add the
timedeltas (seconds) to it and providing that to the plot I guess,
right?
So far the solution to just show i.e. 70sec as 00:01:20 via some
little function is almost more sympathetic to me (so far at least).
Cheers and thanks,
marco
-- 
 (o_ It rocks: LINUX + Command-Line-Interface
 //\ GPG: 0x59D90F4D
 V_/_ http://www.calmar.ws
From: Benjamin R. <ben...@ou...> - 2011年06月10日 16:10:29
On Fri, Jun 10, 2011 at 11:01 AM, calmar c. <ma...@ca...> wrote:
> On Fri, Jun 10, 2011 at 09:00:28AM -0400, Scott Lasley wrote:
> >
> > One way would be to use a matplotlib.ticker.FuncFormatter
> >
> > import matplotlib.pyplot as plt
> > import matplotlib.ticker
> >
> > def HMSFormatter(value, loc):
> > h = value // 3600
> > m = (value - h * 3600) // 60
> > s = value % 60
> > return "%02d:%02d:%02d" % (h,m,s)
> >
> > fig = plt.figure()
> > sp = fig.add_subplot(111)
> > xaxis = sp.get_xaxis()
> > xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(HMSFormatter))
> > seconds = range(12341,12641,30)
> > data = range(10)
> > sp.plot(seconds, data)
> > fig.canvas.draw()
> fig.show() needed here.
>
> Ah ok, great, many thanks.
>
>
> In the case the x is already HH:MM:SS that's a whole other story I
> guess?
>
> anyway,
> cheers
> marco
>
>
Why not just use an array of datetime.timedelta objects? I believe
matplotlib already supports this, does automatic formatting and even allows
you to easily modify how the formatting is done.
Ben Root
From: calmar c. <ma...@ca...> - 2011年06月10日 16:01:46
On Fri, Jun 10, 2011 at 09:00:28AM -0400, Scott Lasley wrote:
> 
> One way would be to use a matplotlib.ticker.FuncFormatter
> 
> import matplotlib.pyplot as plt
> import matplotlib.ticker
> 
> def HMSFormatter(value, loc):
> h = value // 3600
> m = (value - h * 3600) // 60
> s = value % 60
> return "%02d:%02d:%02d" % (h,m,s)
> 
> fig = plt.figure()
> sp = fig.add_subplot(111)
> xaxis = sp.get_xaxis()
> xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(HMSFormatter))
> seconds = range(12341,12641,30)
> data = range(10)
> sp.plot(seconds, data)
> fig.canvas.draw()
fig.show() needed here.
Ah ok, great, many thanks.
In the case the x is already HH:MM:SS that's a whole other story I
guess?
anyway,
cheers
marco
-- 
 (o_ It rocks: LINUX + Command-Line-Interface
 //\ GPG: 0x59D90F4D
 V_/_ http://www.calmar.ws
From: Benjamin R. <ben...@ou...> - 2011年06月10日 15:12:30
On Fri, Jun 10, 2011 at 9:24 AM, Jorge Scandaliaris
<jor...@ya...>wrote:
> Hi,
>
> Are events supposed to be used in non-interactive mode? I've been having
> some
> weird issues recently (see
>
> http://thread.gmane.org/gmane.comp.python.matplotlib.general/26233/focus=26267
> )
> which, just by chance, I pinned down to having matplotlib.interactive(True)
> in
> my custom ipython's pylab profile. What's the relationship between both
> things?
> I couldn't find much about interactive mode in the docs.
>
> Maybe this does not add useful info to the problem, but I have also noticed
> a
> difference in behavior when running scripts with events handling and
> interactive
> mode on from ipython compared to python. The figure(s) stay displayed when
> using
> ipython, although custom events don't work (predefined events like pan/zoom
> still work), while in python the figures are closed once the script
> finishes.
>
> At least I have a way now to run my scripts from within ipython, even if I
> don't
> understand what's going on.
>
> jorges
>
>
Jorges,
iPython can do some special things with matplotlib's interactivity when
invoked in certain ways (hence why it was called "interactive" python). I
don't know the particulars of what ipython does, but this does not surprise
me. Does everything work as you expect in interactive mode through regular
python?
Ben Root
From: Jorge S. <jor...@ya...> - 2011年06月10日 14:25:23
Hi,
Are events supposed to be used in non-interactive mode? I've been having some
weird issues recently (see
http://thread.gmane.org/gmane.comp.python.matplotlib.general/26233/focus=26267)
which, just by chance, I pinned down to having matplotlib.interactive(True) in
my custom ipython's pylab profile. What's the relationship between both things?
I couldn't find much about interactive mode in the docs.
 
Maybe this does not add useful info to the problem, but I have also noticed a
difference in behavior when running scripts with events handling and interactive
mode on from ipython compared to python. The figure(s) stay displayed when using
ipython, although custom events don't work (predefined events like pan/zoom
still work), while in python the figures are closed once the script finishes.
At least I have a way now to run my scripts from within ipython, even if I don't
understand what's going on.
jorges
From: Johannes R. <JRa...@gm...> - 2011年06月10日 13:31:55
-------- Original-Nachricht --------
> Datum: 2011年6月10日 14:40:17 +0200
> Von: Sebastian Berg <seb...@si...>
> An: Johannes Radinger <JRa...@gm...>
> CC: mat...@li...
> Betreff: Re: [Matplotlib-users] fill-between special demand
> On Fri, 2011年06月10日 at 14:15 +0200, Johannes Radinger wrote:
> > Hello,
> > 
> > I know that it is possible to fill an area between to curves (functions)
> with "fill between".
> > 
> > In my case I've got let's say 10 curves of different shape. I'd like to
> fill the area between the most upper lines and the most lower lines. Is
> that somehow possible? One work-around which appeared in my mind was to use
> fill-between for all possible combinations of 2 functions out of the 10, but
> thats somehow stupid work if there is another possibility...
> > 
> > I hope a made myself clear enough...and hopefully you can help me.
> > 
> > /Johannes
> 
> Hi,
> 
> use numpy to calculate the upper and lower limits first?
> 
> curves = np.random.randn(1000, 10)
> plt.fill_between(np.arange(1000), curves.min(1), curves.max(1))
hmm. I am not sure what you mean exactly. In my case i've got following function:
def pdf(x,s1,s2,p):
 return (p/(math.sqrt(2*math.pi*s1**2))*numpy.exp(-((x-0)**(2)/(2*s1**(2)))))+((1-p)/(math.sqrt(2*math.pi*s2**2))*numpy.exp(-((x-0)**(2)/(2*s2**(2)))))
and s1,s2 and p are varying... so i have a list like
123, 3215, 0.3
152, 2351, 0.4
521, 4351, 0.6
...
for these three parameters. So the resulting curves are probably intersecting each other and are of different shape.
so two questions:
1) what is the best way to supply this list to produce the single curves (about 10)
2) how can I do the fill between to get the "range" of the curves. Maybe you can give me a more detailed example.
Thanks
/Johannes
> 
> of course if the x values ar enot all the same you will have to
> interpolate...
> 
> Regards,
> 
> Sebastian
> 
-- 
NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone
From: Sebastian B. <seb...@si...> - 2011年06月10日 12:40:46
On Fri, 2011年06月10日 at 14:15 +0200, Johannes Radinger wrote:
> Hello,
> 
> I know that it is possible to fill an area between to curves (functions) with "fill between".
> 
> In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility...
> 
> I hope a made myself clear enough...and hopefully you can help me.
> 
> /Johannes
Hi,
use numpy to calculate the upper and lower limits first?
curves = np.random.randn(1000, 10)
plt.fill_between(np.arange(1000), curves.min(1), curves.max(1))
of course if the x values ar enot all the same you will have to
interpolate...
Regards,
Sebastian
From: Johannes R. <JRa...@gm...> - 2011年06月10日 12:15:16
Hello,
I know that it is possible to fill an area between to curves (functions) with "fill between".
In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility...
I hope a made myself clear enough...and hopefully you can help me.
/Johannes
-- 
NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone
From: calmar c. <ma...@ca...> - 2011年06月10日 09:27:16
Hi all,
what could be a simple way when I have 'seconds' as data to
display them as %H:%M:%S on the x-axes?
many thanks
marco
-- 
 (o_ It rocks: LINUX + Command-Line-Interface
 //\ GPG: 0x59D90F4D
 V_/_ http://www.calmar.ws

Showing 10 results of 10

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