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

Showing 8 results of 8

From: Perry G. <pe...@st...> - 2004年12月11日 17:44:28
John Hunter wrote:
[...]
> 
> By default, matplotlib defers drawing until the end of the script
> because drawing can be an expensive opertation, and you may not
> want to update the plot every time a single property is changed, only
> once after all the properties have changed.
> 
> But in interactive mode, eg from the python shell, you usually do want
> to update the plot with every command, eg, after changing the xlabel
> or the marker style of a line. With the TkAgg backend, you can use
> matplotlib from an arbitrary python shell. Just set TkAgg to be your
> default backend and interactive to be True in your matplotlibrc file
> and fire up python. Then
> 
> >>> from pylab import *
> >>> plot([1,2,3])
> >>> xlabel('hi mom')
> 
> should work out of the box. Note, in batch mode, ie when making
> figures from scripts, interactive mode can be slow since it redraws
> the figure with each command. So you may want to think carefully
> before making this the default behavior. TkAgg sets interactive mode
> to True when you issue the show command.
> 
[...]
I'd just add that we may want to recommend that using ioff(), ion()
be part of the matplotlib idiom for writing demos and larger, more
involved plotting programs and scripts particularly where the 
author of the script or function is unsure of what context it
will be run in. That way it always runs efficiently. Does that
seem a reasonable thing to recommend?
Perry
From: John H. <jdh...@ac...> - 2004年12月11日 17:28:21
>>>>> "Perry" == Perry Greenfield <pe...@st...> writes:
 Perry> John Hunter Wrote:>
 >> Aside from the aforementioned "run" mode of ipython, which does
 >> just this, the basic incantation is
 >> 
 >> >>> from matplotlib import interactive, is_interactive >>> b =
 >> is_interactive() # store the current interactive state >>>
 >> plot(blah, blah) # make some plots >>> interactive(False) #
 >> turn interactive off >>> for i in arange(1e4096):
 >> plot(arange(i), arange(i)**2) # don't try this at home >>>
 >> interactive(b) # restore previous interactive state
 >> 
 >> Basically, this is what ipython does. This is wrapped into a
 >> single function "run", called like
 >> 
 >> >>> x = 1 # some fluff >>> run ~/myexamples/simple_demo.py #
 >> turn interactive off for run >>> x = 2 # interactive setting is
 >> restored
 >> 
 >> But of course, you can use the interactive / is_interactive
 >> functions in any script or interactive session.
 >> 
 >> To make this more accessible, perhaps we should add an
 >> interactive (or update) kwarg to plot and friends, in the same
 >> vein that we discussed a kwarg for hold, so you can easily do
 >> things like
 >> 
 >> plot(x, y, hold=False) # add plot, clearing previous plot(x, y,
 >> update=False) # add plot but do not update
 >> 
 >> But the question arises, does the additional complexity in the
 >> matplotlib internals required to support this justify the
 >> savings for the occasional user who would otherwise have to
 >> type a couple of extra lines?
 >> 
 Perry> In this case I don't think so. the function interactive()
 Perry> is what I was looking for, not a keyword argument. Unlike
 Perry> overplotting, I think interactive() is likely to be used
 Perry> almost entirely in scripts and functions and that is by far
 Perry> the better approach. So it's already good enough as far as
 Perry> I'm concerned.
Following these discussions, I just added ion and ioff to the pylab
interface, and updated the web site interaction page with (not
uploaded yet) with the following. Let me know if you have anything to
add here.
By default, matplotlib defers drawing until the end of the script
because drawing can be an expensive opertation, and you may not
want to update the plot every time a single property is changed, only
once after all the properties have changed.
But in interactive mode, eg from the python shell, you usually do want
to update the plot with every command, eg, after changing the xlabel
or the marker style of a line. With the TkAgg backend, you can use
matplotlib from an arbitrary python shell. Just set TkAgg to be your
default backend and interactive to be True in your matplotlibrc file
and fire up python. Then
>>> from pylab import *
>>> plot([1,2,3])
>>> xlabel('hi mom')
should work out of the box. Note, in batch mode, ie when making
figures from scripts, interactive mode can be slow since it redraws
the figure with each command. So you may want to think carefully
before making this the default behavior. TkAgg sets interactive mode
to True when you issue the show command.
Unfortunately, due to the 'mainloop' cycle of GUI toolkits, it is not
yet possible to use matplotlib from an arbitrary python shell with the
other GUI backends. You must use a custom python shell that runs the
GUI is a separate thread.
The recommended way to use matplotlib interactively from a shell is
with ipython, which has an pylab mode that detects your matplotlib
.matplotlibrc file and makes the right settings to run matplotlib with
your GUI of choice in interactive mode using threading. gtk users
will need to make sure that they have compiled gtk with threading for
this to work. Using ipython in pylab mode is basically a nobrainer
because it knows enough about matplotlib internals to make all the
right settings for you internally
 peds-pc311:~> ipython -pylab
 Python 2.3.3 (#2, Apr 13 2004, 17:41:29) 
 Type "copyright", "credits" or "license" for more information.
 IPython 0.6.5 -- An enhanced Interactive Python.
 ? -> Introduction to IPython's features.
 %magic -> Information about IPython's 'magic' % functions.
 help -> Python's own help system.
 object? -> Details about 'object'. ?object also works, ?? prints more.
 Welcome to pylab, a matplotlib-based Python environment.
 help(matplotlib) -> generic matplotlib information.
 help(matlab) -> matlab-compatible commands from matplotlib.
 help(plotting) -> plotting commands.
 >>> plot( rand(20), rand(20), 'go' )
Note that you did not need to import any matplotlib names because in
pylab mode ipython will import them for you. ipython turns on
interactive mode for you, and also provides a "run" command so you can
run matplotlib scripts from the matplotlib shell and then
interactively update your figure. ipython will turn off interactive
mode during a run command for efficiency, and then restore the
interactive state at the end of the run.
 >>> cd python/projects/matplotlib/examples/
 /home/jdhunter/python/projects/matplotlib/examples
 >>> run simple_plot.py
 >>> title('a new title', color='r')
The pylab interface provides 4 commands that are useful for
interactive control. Note again that the interactgive setting
primarily controls whether the figure is redrawn with each plotting
command. is_interactive returns the interactive setting, ion turns
interactive on, ioff turns it off, and draw forces a redraw of the
entire figure. Thus when working with a big figure in which drawing
is expensive, you may want to turn matplotlib's interactive setting
off temporarily to avoid the performance hit
 >>> run mybigfatfigure.py
 >>> ioff() # turn updates off
 >>> title('now how much would you pay?')
 >>> xticklabels(fontsize=20, color='green')
 >>> draw() # force a draw
 >>> savefig('alldone', dpi=300)
 >>> close()
 >>> ion() # turn updates back on
 >>> plot(rand(20), mfc='g', mec='r', ms=40, mew=4, ls='--', lw=3)
From: Perry G. <pe...@st...> - 2004年12月11日 17:07:28
John Hunter Wrote:> 
> Aside from the aforementioned "run" mode of ipython, which does just
> this, the basic incantation is
> 
> >>> from matplotlib import interactive, is_interactive
> >>> b = is_interactive() # store the current interactive state
> >>> plot(blah, blah) # make some plots
> >>> interactive(False) # turn interactive off
> >>> for i in arange(1e4096): plot(arange(i), arange(i)**2) # 
> don't try this at home
> >>> interactive(b) # restore previous interactive state
> 
> Basically, this is what ipython does. This is wrapped into a single
> function "run", called like
> 
> >>> x = 1 # some fluff
> >>> run ~/myexamples/simple_demo.py # turn interactive off for run
> >>> x = 2 # interactive setting is restored
> 
> But of course, you can use the interactive / is_interactive functions
> in any script or interactive session.
> 
> To make this more accessible, perhaps we should add an interactive (or
> update) kwarg to plot and friends, in the same vein that we discussed
> a kwarg for hold, so you can easily do things like
> 
> plot(x, y, hold=False) # add plot, clearing previous
> plot(x, y, update=False) # add plot but do not update
> 
> But the question arises, does the additional complexity in the
> matplotlib internals required to support this justify the savings for
> the occasional user who would otherwise have to type a couple of extra
> lines?
> 
In this case I don't think so. the function interactive() is what
I was looking for, not a keyword argument. Unlike overplotting,
I think interactive() is likely to be used almost entirely in
scripts and functions and that is by far the better approach.
So it's already good enough as far as I'm concerned.
Perry 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Haibao T. <ba...@ug...> - 2004年12月11日 16:36:42
SGkgT3V5YW5nLA0KDQpGaXJzdCBjb25ncmF0dWxhdGlvbnMgb24gZmluZGluZyBtYXRwbG90
bGliLCBpdCBpcyByZWFsbHkgDQp0aGUgYmVzdC1xdWFsaXR5IHB5dGhvbiAyRCBwbG90dGlu
ZyBtb2R1bGUgeW91IGNhbiBmaW5kIG9uIA0KdGhlIHdlYiwgYW5kIHRoZSBwcm9qZWN0IGlz
IGFjdGl2ZSAoZ3JlYXQpLiBJdCBjYW4gdXNlIA0KQ2hpbmVzZSBjaGFyYWN0ZXJzLCBidXQg
bWFrZSBzdXJlIHRoYXQgeW91ciBiYWNrZW5kIERPRVNOJ1QgDQp1c2UgJ0FnZycsIGZvciBl
eGFtcGxlIHRoZSBmb2xsb3dpbmcgY29kZSB3aWxsIHdvcmsgdW5kZXIgLQ0KZFdYLCBidXQg
bm90IC1kV3hBR0c6DQoNCiMgLSotIGNvZGluZzogdXRmLTggLSotIA0KZnJvbSBtYXRwbG90
bGliLm1hdGxhYiBpbXBvcnQgKg0KZm9udCA9IHsnZm9udG5hbWUnICAgOiAnU0lNU1VOJywN
CiAgICAgICAgJ2NvbG9yJyAgICAgIDogJ3InKQ0KcGxvdChbMSwyLDNdLCdidi0nKQ0KdGl0
bGUoIuWkp+WutuWlve+8gSIuZGVjb2RlKCJtYmNzIiksZm9udCkNCnNob3coKQ0KDQpOT1RF
IHRoYXQgdGhpcyByZXF1aXJlcyB5b3VyIHN5c3RlbSB0byBiZSBXSU5ET1dTLWNoaW5lc2UN
Cihvb3BzKSwgb3RoZXJ3aXNlLCB5b3UgaGF2ZSB0byBpbnN0YWxsIHJlbGF0ZWQgY29kZWNz
IHdoaWNoIA0KaSB3aWxsIG5vdCBlbGFib3JhdGUgaGVyZS4gRm9yIHNvbWUgcmVhc29uIHRo
ZSBBZ2cgYmFja2VuZHMgDQpmYWlscyBldmVuIGlmIHlvdSBoYXZlIHRoZSByaWdodCBjb2Rp
bmcsIGluIGxpbmUgMjE5IA0KZ2V0X3RleHRfd2lkdGhfaGVpZ2h0KCksIGl0IHJhaXNlcyBh
biB1bmljb2RlIGVycm9yLiANCg0KRm9yIGEgcGllY2hhcnQsIHlvdSBjYW4gc3RhcnQgd3Jp
dGluZyB5b3VyIG93biwgSkRIIGhhcyANCmFscmVhZHkgZGVmaW5lZCBhbG1vc3QgYWxsIHRo
ZSBjb21wb25lbnRzIGZvciBkb2luZyB0aGlzLCANCmFuZCB5b3UgbWF5IGNvbnRyaWJ1dGUg
eW91ciBjb2RlIHNvbWVkYXk6KSBGb3IgYSBsYXp5IHBlcnNvbiANCmxpa2UgbWUsIEkgdGVt
cG9yYXJpbHkgdXNlIHB5dGhvbiB3cmFwcGVyIGZvciBjaGFydGRpcmVjdG9yLg0KDQpIYWli
YW8gVGFuZw0K
From: John H. <jdh...@ac...> - 2004年12月11日 06:01:04
>>>>> "Perry" == Perry Greenfield <pe...@st...> writes:
 Perry> But that made me wonder whether or not there was a need for
 Perry> some sort of switch that delayed any update for just this
 Perry> case where one is looping over many plots (say you wrote a
 Perry> ploting function that did this that you want to run in
 Perry> interactive mode, and you wanted to use basic plotting
 Perry> functions like plot). Is there a simple mechanism to turn
 Perry> off interactive mode temporarily within the function and
 Perry> restore it at the end? If not, could it be added? (akin to
 Perry> the hold() function)
Aside from the aforementioned "run" mode of ipython, which does just
this, the basic incantation is
 >>> from matplotlib import interactive, is_interactive
 >>> b = is_interactive() # store the current interactive state
 >>> plot(blah, blah) # make some plots
 >>> interactive(False) # turn interactive off
 >>> for i in arange(1e4096): plot(arange(i), arange(i)**2) # don't try this at home
 >>> interactive(b) # restore previous interactive state
Basically, this is what ipython does. This is wrapped into a single
function "run", called like
 >>> x = 1 # some fluff
 >>> run ~/myexamples/simple_demo.py # turn interactive off for run
 >>> x = 2 # interactive setting is restored
But of course, you can use the interactive / is_interactive functions
in any script or interactive session.
To make this more accessible, perhaps we should add an interactive (or
update) kwarg to plot and friends, in the same vein that we discussed
a kwarg for hold, so you can easily do things like
 plot(x, y, hold=False) # add plot, clearing previous
 plot(x, y, update=False) # add plot but do not update
But the question arises, does the additional complexity in the
matplotlib internals required to support this justify the savings for
the occasional user who would otherwise have to type a couple of extra
lines?
JDH
From: zhihua o. <zx...@ya...> - 2004年12月11日 03:58:20
Hi everyone,
 I just found matplotlib and like high quality charts
very much. I am wondering if matplotlib support
Chinese Characters? When the pie Chart function will
be added into matplotlib? 
Thanks
Ouyang
		
__________________________________ 
Do you Yahoo!? 
Send holiday email and support a worthy cause. Do good. 
http://celebrity.mail.yahoo.com
From: Perry G. <pe...@st...> - 2004年12月11日 02:06:36
John Hunter wrote:
> Plots of this size should be extremely fast - you should be able to
> plot arrays 10 times this big with good performance. From your
> description "It does first draw a default plot ..and then overplot on
> it for each subplot." it sounds like you may have interactive mode
> turned on. This would kill your performance in a case like this,
> because the entire figure would be redrawn with the update of every
> single plotting command. See
> http://matplotlib.sourceforge.net/interactive.html and
> http://matplotlib.sourceforge.net/faq.html#SHOW .
> 
> To definitively determine what mode you are in, run your script with 
> 
> > python simple_plot.py --verbose-helpful
> 
> and verify that 'interactive is False'. Fernando Perez's ipython has
> support for running scripts from the interactive shell, turning off
> interactive mode for the duration of the run, and then restoring it.
> 
I wondered the same thing and mentioned that to him privately
(in effect you are doing n*(n-1)/2 plots instead of n).
But that made me wonder whether or not there was a need for some
sort of switch that delayed any update for just this case where
one is looping over many plots (say you wrote a ploting function
that did this that you want to run in interactive mode, and you
wanted to use basic plotting functions like plot). Is there a 
simple mechanism to turn off interactive mode temporarily within
the function and restore it at the end? If not, could it be added?
(akin to the hold() function)
Perry
From: Chris B. <Chr...@no...> - 2004年12月11日 00:46:19
John Hunter wrote:
>>>>>>"Chris" == Chris Barker <Chr...@no...> writes:
> Chris> completely irregular? or only orthogonal structured
> Chris> grids. From your description, it sounds like the
> Chris> later. Could it take an unstructured set of (x,y,z) points
> Chris> and contour the z values?
> 
> The latter, I believe.
yup. from the below referenced link:
"""
General purpose contour tracer for quadrilateral meshes.
"""
So it won't handle arbitrary unstructured points, but it's nice none the 
less. With an interpolator to a rectangular grid, you could use it for 
any array of points, I think someone posted an example of this on the 
matplotlib list.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...

Showing 8 results of 8

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