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






Showing 7 results of 7

From: John J. <jja...@al...> - 2010年02月13日 20:53:28
HI,
I find the very basic animation below has a memory leak (my pagefile usage
number keeps growing in the Windows XP Windows Task Manager Performance
graph).I don't see this with the "animation_blit_gtk.py" example on:
http://matplotlib.sourceforge.net/examples/index.html
(which I used as a starting point for this). In "animation_blit_gtk.py" the
set_ydata() routine is used to update the line for the animation and this
does not leak. But if you call plot again with the new y_data (instead of
using set_ydata), this leaks too. Anyone have an idea on how to stop the
leak? 
thanks,
john
import gtk, gobject
import matplotlib
matplotlib.use('GTKAgg') 
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
from matplotlib.patches import CirclePolygon
fig = plt.figure(figsize=(10,6))
ax = fig.add_subplot(111, autoscale_on=False )
canvas = fig.canvas
plt.axis([-1, 7, -0.5, 2.2])
def update_line():
 global x, y
 print update_line.cnt
 if update_line.background is None:
 update_line.background = canvas.copy_from_bbox(ax.bbox)
 canvas.restore_region(update_line.background)
 
 x_cir = 1.0 + 0.003*update_line.cnt 
 cir = CirclePolygon((x_cir, 1), 0.3, animated=True, \
 resolution=12, lw=2 )
 ax.add_patch(cir)
 ax.draw_artist(cir)
 
 canvas.blit(ax.bbox)
 
 if update_line.direction == 0:
 update_line.cnt += 1
 if update_line.cnt > 500:
 update_line.direction = 1
 else:
 update_line.cnt -= 1
 if update_line.cnt < 100:
 update_line.direction = 0
 
 return True
update_line.cnt = 0
update_line.direction = 0
update_line.background = None
def start_anim(event):
 gobject.idle_add(update_line)
 canvas.mpl_disconnect(start_anim.cid)
start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
plt.show()
From: Jae-Joon L. <lee...@gm...> - 2010年02月13日 20:21:11
On Fri, Feb 12, 2010 at 1:48 PM, Tomasz Koziara
<t.k...@ci...> wrote:
> but then axis labels or even numbering gets cut off. On the other hand
> playing with:
>
You need to manually adjust subplot parameters
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust
> plt.axes().set_aspect (2.0)
>
> does amazingly strange things. The explanation about what the number
> in the set_aspect function should be is quite vogue in the
> documentation. Hence my questions:
>
The aspect in axes is a aspect ratio of unit rectangle in the data
coordinate. It is similar to a pixel aspec ratio
(http://en.wikipedia.org/wiki/Pixel_aspect_ratio).
And, to me, the documentation makes sense. Let us know if you have
any suggestion to improve the documentation though.
> How to specify the aspect ratio of a figure (in my case containing
> some bar plots) so that all remaining things (like axis labels) are
> respected in the final result?
As I said, you need to manually adjust the subplot parameters (or
location of the axes). I guess this is more like a design decision.
You may try to automate things, as in the example below.
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels
While it only makes a room for ticklabels, you can extend this to axis
labels and etc.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年02月13日 20:01:20
If you're happy with the default formatter behavior (which seems to
match with your #3 requirement), just reuse it.
class MyFormatter(ScalarFormatter):
 def __call__(self, val, pos=None):
 if val < 0:
 return ''
 else:
 return ScalarFormatter.__call__(self, val)
-JJ
On Fri, Feb 12, 2010 at 5:24 PM, C M <cmp...@gm...> wrote:
> I would like a custom formatter that does 3 things:
>
> 1) Blanks out all the values less than 0.
> 2) Chooses appropriate major ticks when zoomed out.
> 3) Shows an integer when the zoom scale is revealing multiple
> integers, but shows a decimal number when it is just showing within
> one integer; i.e. if it is 1, 2, 3, 4 in first case but 1.1, 1.2,
> 1.3, 1.4 in the second.
>
> So far I have needs (1) and (2) of this with this super-simple custom formatter:
>
> class MyFormatter(ScalarFormatter):
>  def __call__(self, val, pos=None):
>    if val < 0:
>      return ''
>    else:
>      return int(val)
>
> But how can I get need (3)? I need to know what the view_interval is
> to set a rule for this. Something like:
>
> if view_interval < 1:
>  return val  #this will be a decimal number
> else:
>  return int(val) #an integer
>
> So how do I get the view_interval? I'm not understanding how to get
> that from matplotlib.ticker.TickHelper()--if that is even the right
> way to do it--because get_view_interval() is not a method of
> TickHelper but of "DummyAxis", and at that point I've lost the idea.
>
> Any help is appreciated. Thanks,
> Che
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Wayne W. <sie...@sb...> - 2010年02月13日 13:10:58
In this case, it's spelling errors, mostly. axes for axis, etc.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: Wayne W. <sie...@sb...> - 2010年02月13日 03:40:15
Certainly in IDLE, when one hits a show() in a def, the program does not 
continue to the next statement. It goes somewhere else, because my 
program continues normally. Apparently, it goes back up the def calls to 
the "main" program, which is a loop that just reads the next file to 
perform more of what I expect. If I know this to be true*, that allows 
a "workaround" with globals.
* There is another def that uses plot-show, and it continues without any 
notable difficulty. The show() is the last statement in the def. Of 
course, since show() is a legitimate use, if one knows the "end" rule, 
this seems quite reasonable way to operate.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: Wayne W. <sie...@sb...> - 2010年02月13日 03:11:21
Thanks. True enough. I've been exploring that possibility, and it is 
probably the way to go. When I get a little further down the line, I'll 
probably distribute it that way.
On 2/12/2010 9:35 AM, Christopher Barker wrote:
> Wayne Watson wrote:
> 
>> So here's my list of thing to do when I come back to it.
>> 
> good plan, one comment:
>
> 
>> Determine if a better interpreter tool than IDLE would satisfy the end
>> users of the program I'm modifying. The hurdle is non-Python users who
>> just fire up IDLE and execute the program via F5.
>> 
> This one is a no brainer -- IDLE is an Integrated Development
> Environment -- if you are not developing, you don't need it, t is NOT a
> tool to run simply run a python program. It's really not hard to run a
> python program.
>
> Note that py2exe and friends might be the best solution -- these are
> tools that build a self-contained executable from a python program, so
> you end up with something to double click on, just like any other program.
>
> I don't know about TkInter, but wxPython has an option where it will put
> up a message window to show the user standard output -- it sounds like
> you want the user to see messages, etc. Maybe TK has something similar.
>
> Good luck,
>
> -Chris
>
>
>
>
> 
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: T J <tj...@gm...> - 2010年02月13日 03:05:15
Hi,
When plotting,
 plot(x, y, marker="-")
and its similar markers, what functionality in MPL is responsible for
interpolating between the points? My naive guess is that
interpolation is done in "display" coordinates since everything looks
nice even when zooming in. I inquire because I'd like to make
interpolation between two points follow some other path between the
two points. In other words, I'd like to make a plot structure which
will follow a different type of geodesic. Any tips or pointers in the
right direction would be greatly appreciated.
Thanks!

Showing 7 results of 7

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