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






Showing 15 results of 15

From: Eric F. <ef...@ha...> - 2006年12月07日 22:32:09
Pierre GM wrote:
> Talking about pcolormesh:
> I was just playing with it right now, and it doesn't accept the 'shading' 
> keyword. Poking around shows that kwargs.pop('shading','flat') should be 
> used instead of kwargs.get('shading') in axes.py (same goes for the other 
> parameters...)
Thanks. I have fixed this in svn and added the same X,Y argument 
handling that I added to pcolor yesterday.
Now, if we could only fix the alpha bug, pcolormesh could probably 
replace pcolor entirely. It is much faster for large arrays. There is 
a problem similar to one recently pointed out in imshow, however: 
zooming in to a small piece of a large array gets very slow. Pcolor 
seems to simply stay slow (maybe speeds up a little) rather then get 
slower as one zooms in. I think we should be able to speed up zooming, 
but I have not looked to see how this might be done. (Imshow is nice and 
fast when displaying and zooming until it runs into the odd problem of 
fading out and/or turning white, which coincides with getting slow.) I 
haven't played with NonUniformImage yet.
Eric
From: Joachim D. <dah...@gm...> - 2006年12月07日 19:46:55
I am generating EPS files from images drawn with imshow(). How do I make
a plot with minimal bounding box? I tried the different axis() arguments,
without getting
the result I am looking for so far. The image is supposed to drawn in
scale, i.e., without
stretching either dimension.
Thanks
Joachim
From: Eric F. <ef...@ha...> - 2006年12月07日 18:23:09
John Hunter wrote:
[...]
> You can pass in a sequence of facecolors the length of your number of
> polygons. Each element of the sequence must be RGBA, but you can use
> matplotlib's color converter to convert an arbitrary color argument to
> RGBA. 
> 
John,
You don't need to do this explicit conversion any more; some time ago I 
made it automatic, so you can pass in directly any sort of colorspec or 
colorspec list.
Eric
From: Eric F. <ef...@ha...> - 2006年12月07日 18:16:55
Robert Cimrman wrote:
> Eric Firing wrote:
>> Robert and any other spy users:
>>
>> I have committed to svn a new axes method, spy3, that combines a 
>> modification of the functionality of both spy and spy2. I hope you 
>> can check it out. If it looks OK, then I would like to simply replace 
>> spy and spy2 with this combined version. In that case the pylab 
>> interface, which now gives access to spy and spy2, would have a single 
>> spy function which would access the new version. My suspicion is that 
>> spy is used almost entirely in interactive mode, and probably not by 
>> very many people, so that this changeover can be made quickly with 
>> little disruption to present users.
>>
>> Attached is a script illustrating the difference in the way spy3 
>> displays a matrix (it matches the way it is printed: first index is 
>> row number, second is column number, row number increases down) versus 
>> what spy and spy2 do (first index is X, second index is Y).
>>
>> Also attached is the diff for spy3.
>>
>> Users may want to comment in particular on the default for the 
>> "aspect" kwarg. Presently it is set to "equal" so that the shape of 
>> the plot is the shape of the array with square cells. This differs 
>> from spy and spy2. The rationale is that it gives the best picture of 
>> what the array looks like, including its shape.
> 
> Thumbs up :), just add the sparse-full matrix switch to the imshow 
> branch too, if possible. But I am happy with it as it is.
Robert,
The sparse-full difference only works with the plot mode; for an image 
there is no alternative to providing a value for every pixel, so I don't 
know of any way to optimize it for the case of sparse storage. A 
polygon collection could be used to achieve the same result in this 
case. I'm not sure it is a good idea, though, because there would be an 
advantage of not converting to a regular array only in the case where 
the array is so large that such a conversion would use a big chunk of 
memory, and in that case the polygons probably would be less than 
single-pixel size anyway, so one would be better off using the present 
symbol-plotting mode.
Anyway, I'm glad it works for you. Thanks for checking.
Eric
From: John H. <jdh...@ac...> - 2006年12月07日 15:56:46
>>>>> "Gary" == Gary Ruben <gr...@bi...> writes:
 Gary> While I think of it, I think the default zorder of legends
 Gary> should be bigger so that, by default it overlays all plot
 Gary> lines and symbols.
The default zorder is 5, which is higher than any other as far as I
can see. Can you post a script which shows a problem.
JDH
From: John H. <jdh...@ac...> - 2006年12月07日 15:49:23
>>>>> "Pellegrini" == Pellegrini Eric <eri...@ya...> writes:
 Pellegrini> Hi John, thank you very much for the hand.
 
 Pellegrini> I think that I have found my mistake. I was
 Pellegrini> launching my script trough "Idle" that seems to be the
 Pellegrini> reason why it was to slow. Running my script with the
 Pellegrini> command line or by double-clicking on it gave results
 Pellegrini> similar to yours. Would you know why Idle application
 Pellegrini> slows down so much the execution of my script ?
Probably because you are running in "interactive" mode and matplotlib
is redrawing your figure on every fill command. See
http://matplotlib.sf.net/interactive.html for details. You can
temporarily turn interaction on and off with the ion and ioff
functions. Something like
ioff()
for x in somerange():
 fill(...)
ion()
Then matplotlib will turn off drawing for the loop.
 
 Pellegrini> By the way, using the Collection class, would you
 Pellegrini> have any idea how to set different colors to the
 Pellegrini> polygons ? Using set_color method change the color of
 Pellegrini> all the plygons.
You can pass in a sequence of facecolors the length of your number of
polygons. Each element of the sequence must be RGBA, but you can use
matplotlib's color converter to convert an arbitrary color argument to
RGBA. 
from colors import colorConverter
colors = [colorConverter.to_rgba(x) for x in ('red', 'green', 'black', 'y', '0.8')]
collection = PolyCollection(verts, facecolors = colors)
You can also use colormapping with a PolyCollection where "c" below is an array of scalar intensities and cmap is a matplotlib.cm colormap, eg cm.jet and norm
 collection.set_array(asarray(c))
 collection.set_cmap(cmap)
Collections are covered at
http://matplotlib.sf.net/matplotlib.collections.html and in the user's
guide PDF on the web site.
JDH
From: Gary R. <gr...@bi...> - 2006年12月07日 12:21:21
While I think of it, I think the default zorder of legends should be 
bigger so that, by default it overlays all plot lines and symbols.
Gary R.
From: Gary R. <gr...@bi...> - 2006年12月07日 12:20:08
There may be problems i.e. bugs in the eps and svg backends, as I often 
try (sometimes unsuccessfully) to edit these in inkscape and/or 
CorelDraw and sometimes, but not always, get 'badly formed eps file' 
messages from Corel, or spurious lines appearing in svg files in 
inkscape and Corel, for example. Do others get this too?
A suggestion:
When saving in a vector format, is it possible to remove objects totally 
outside the bounding box from the output files in some smart way? I 
guess this is currently left up to the individual backends to decide on, 
but perhaps implementing some filtering functions for the backends to 
use would encourage their use and help make output files smaller.
Gary R.
From: Robert C. <cim...@nt...> - 2006年12月07日 11:47:00
Eric Firing wrote:
> Robert and any other spy users:
> 
> I have committed to svn a new axes method, spy3, that combines a 
> modification of the functionality of both spy and spy2. I hope you can 
> check it out. If it looks OK, then I would like to simply replace spy 
> and spy2 with this combined version. In that case the pylab interface, 
> which now gives access to spy and spy2, would have a single spy function 
> which would access the new version. My suspicion is that spy is used 
> almost entirely in interactive mode, and probably not by very many 
> people, so that this changeover can be made quickly with little 
> disruption to present users.
> 
> Attached is a script illustrating the difference in the way spy3 
> displays a matrix (it matches the way it is printed: first index is row 
> number, second is column number, row number increases down) versus what 
> spy and spy2 do (first index is X, second index is Y).
> 
> Also attached is the diff for spy3.
> 
> Users may want to comment in particular on the default for the "aspect" 
> kwarg. Presently it is set to "equal" so that the shape of the plot is 
> the shape of the array with square cells. This differs from spy and 
> spy2. The rationale is that it gives the best picture of what the array 
> looks like, including its shape.
Thumbs up :), just add the sparse-full matrix switch to the imshow 
branch too, if possible. But I am happy with it as it is.
r.
From: Pellegrini E. <eri...@ya...> - 2006年12月07日 09:29:22
I forgot to send the output of the python test.py --verbose-helpful. Perhaps you will find something wrong there. Here it is:
 
 ################################"
 matplotlib data path C:\Python24\lib\site-packages\matplotlib\mpl-data
$HOME=C:\Documents and Settings\Eric
CONFIGDIR=C:\Documents and Settings\Eric\.matplotlib
loaded rc file C:\Python24\lib\site-packages\matplotlib\mpl-data\matplotlibrc
matplotlib version 0.87.6
verbose.level helpful
interactive is False
platform is win32
numerix numpy 1.0rc1
font search path ['C:\\Python24\\lib\\site-packages\\matplotlib\\mpl-data']
loaded ttfcache file C:\Documents and Settings\Eric\.matplotlib\ttffont.cache
backend TkAgg version 8.4
########################################"
 
 Thanks again
 
 Eric
 
John Hunter <jdh...@ac...> a écrit :
 >>>>> "Pellegrini" == Pellegrini Eric writes:
Pellegrini> Hi everybody, I would like to build an application
Pellegrini> where many filled polygons will have to be displayed
Pellegrini> on the screen. To do so, I would like to use
Pellegrini> matplotlib but, up to now, my application is not fast
Pellegrini> enough.
Hmm, I'm not seeing the performance problem on my system -- I can
create and save the figure in a fraction of a second. Is your numerix
setting set to numpy? Run the script with --verbose-helpful and send
us the output.
A few things to note: if you really want regular polygons, eg the
squared in your example, do any of the plot markers work for you.
plot(x, marker='s')
will be about as fast as mpl gets. You can set the marker size with
the markersize property.
Second, if you need arbitrary polygons, and need a lot of them, a
polygon collection will be faster. I had to bump the number of polys
up to about 8000 to show a dramatic performance difference.
Here are two scripts and performance numbers -- one using fill and one
using a polygon collection
> time python test.py -dAgg
6.595u 0.089s 0:06.68 99.8% 0+0k 0+0io 0pf+0w
> time python test2.py -dAgg
0.565u 0.033s 0:00.59 100.0% 0+0k 0+0io 0pf+0w
> cat test.py
import pylab
x = range(0,81000,10)
pylab.axis('off')
for i in range(0,len(x)-1):
pylab.fill([x[i],x[i+1],x[i+1],x[i]],[10,10,20,20])
pylab.axis((0,max(x),0,610))
pylab.savefig('test')
pylab.show()
> cat test2.py
import pylab
from matplotlib.collections import PolyCollection
fig = pylab.figure()
ax = fig.add_subplot(111)
x = range(0,81000,10)
pylab.axis('off')
verts = [((x[i], 10), (x[i+1], 10), (x[i+1], 20), (x[i], 20)) for i in range(len(x)-1)]
col = PolyCollection(verts)
ax.add_collection(col)
pylab.axis((0,max(x),0,610))
pylab.savefig('test')
pylab.show()
 		
---------------------------------
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
From: Pierre GM <pgm...@gm...> - 2006年12月07日 09:24:30
Talking about pcolormesh:
I was just playing with it right now, and it doesn't accept the 'shading' 
keyword. Poking around shows that kwargs.pop('shading','flat') should be 
used instead of kwargs.get('shading') in axes.py (same goes for the other 
parameters...)
From: Pellegrini E. <eri...@ya...> - 2006年12月07日 09:11:54
Hi John,
 
 thank you very much for the hand.
 
 I think that I have found my mistake. I was launching my script trough "Idle" that seems to be the reason why it was to slow. Running my script with the command line or by double-clicking on it gave results similar to yours. Would you know why Idle application slows down so much the execution of my script ?
 
 By the way, using the Collection class, would you have any idea how to set different colors to the polygons ? Using set_color method change the color of all the plygons.
 
 Thanks again
 Eric
 
John Hunter <jdh...@ac...> a écrit :
 >>>>> "Pellegrini" == Pellegrini Eric writes:
Pellegrini> Hi everybody, I would like to build an application
Pellegrini> where many filled polygons will have to be displayed
Pellegrini> on the screen. To do so, I would like to use
Pellegrini> matplotlib but, up to now, my application is not fast
Pellegrini> enough.
Hmm, I'm not seeing the performance problem on my system -- I can
create and save the figure in a fraction of a second. Is your numerix
setting set to numpy? Run the script with --verbose-helpful and send
us the output.
A few things to note: if you really want regular polygons, eg the
squared in your example, do any of the plot markers work for you.
plot(x, marker='s')
will be about as fast as mpl gets. You can set the marker size with
the markersize property.
Second, if you need arbitrary polygons, and need a lot of them, a
polygon collection will be faster. I had to bump the number of polys
up to about 8000 to show a dramatic performance difference.
Here are two scripts and performance numbers -- one using fill and one
using a polygon collection
> time python test.py -dAgg
6.595u 0.089s 0:06.68 99.8% 0+0k 0+0io 0pf+0w
> time python test2.py -dAgg
0.565u 0.033s 0:00.59 100.0% 0+0k 0+0io 0pf+0w
> cat test.py
import pylab
x = range(0,81000,10)
pylab.axis('off')
for i in range(0,len(x)-1):
pylab.fill([x[i],x[i+1],x[i+1],x[i]],[10,10,20,20])
pylab.axis((0,max(x),0,610))
pylab.savefig('test')
pylab.show()
> cat test2.py
import pylab
from matplotlib.collections import PolyCollection
fig = pylab.figure()
ax = fig.add_subplot(111)
x = range(0,81000,10)
pylab.axis('off')
verts = [((x[i], 10), (x[i+1], 10), (x[i+1], 20), (x[i], 20)) for i in range(len(x)-1)]
col = PolyCollection(verts)
ax.add_collection(col)
pylab.axis((0,max(x),0,610))
pylab.savefig('test')
pylab.show()
 		
---------------------------------
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
From: belinda t. <bt...@cs...> - 2006年12月07日 04:48:17
Hello,
Is there a way to return a list of all the open figure numbers? For 
instance, if I had:
close('all')
figure(1)
[some plotting]
figure(5)
[some plotting]
I'd like to be able to have access to a command that returns the list 
[1, 5].
Thanks,
--b
From: Steve K. <kac...@co...> - 2006年12月07日 02:29:45
Just installed FC6 onto AMD 64 bit processor and have installed Python.
I have also installed numpy and matplotlib however when I run IPython
and begin importing items I run into a problem when try to import pylab.
Specifically I receive the following dump:
In [3]: import pylab
---------------------------------------------------------------------------
exceptions.ImportError Traceback (most
recent call last)
/home/Dad/<ipython console> 
/usr/lib64/python2.4/site-packages/pylab.py 
----> 1 from matplotlib.pylab import *
/usr/lib64/python2.4/site-packages/matplotlib/pylab.py 
 200 
 201 from axes import Axes, PolarAxes
--> 202 import backends
 203 from cbook import flatten, is_string_like, exception_to_str,
popd, \
 204 silent_list, iterable, enumerate
/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py 
 52 # a hack to keep old versions of ipython working with mpl after
bug
 53 # fix #1209354
 54 if 'IPython.Shell' in sys.modules:
---> 55 new_figure_manager, draw_if_interactive, show =
pylab_setup()
 56 
/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py in
pylab_setup()
 21 backend_name = 'backend_'+backend.lower()
 22 backend_mod =
__import__('matplotlib.backends.'+backend_name,
---> 23 globals(),locals(),[backend_name])
 24 
 25 # Things we pull in from all backends
/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py 
 8 from matplotlib.figure import Figure
 9 from backend_agg import FigureCanvasAgg
---> 10 from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
 11 show, draw_if_interactive,\
 12 error_msg_gtk, NavigationToolbar, PIXELS_PER_INCH,
backend_version, \
/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtk.py 
 19 from matplotlib.backend_bases import RendererBase,
GraphicsContextBase, \
 20 FigureManagerBase, FigureCanvasBase, NavigationToolbar2,
cursors
---> 21 from matplotlib.backends.backend_gdk import RendererGDK,
FigureCanvasGDK
 22 from matplotlib.cbook import is_string_like, enumerate
 23 from matplotlib.colors import colorConverter
/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gdk.py 
 33 from matplotlib.backends._nc_backend_gdk import
pixbuf_get_pixels_array
 34 else:
---> 35 from matplotlib.backends._ns_backend_gdk import
pixbuf_get_pixels_array
 36 
 37 
ImportError: No module named _ns_backend_gdk
I am new to this and would appreciate any help in resolving this
problem. Thanks.
Steve
From: Trivedi, A. <aar...@se...> - 2006年12月07日 02:20:05
I just added these to my sources.list and apt-get update throws this up
Failed to fetch =
http://anakonda.altervista.org/debian/packages/Packages.gz
302 Found Failed to fetch
http://anakonda.altervista.org/debian/sources/Sources.gz 302 Found =
Reading
Package Lists... Done
W: Couldn't stat source package list http://anakonda.altervista.org
packages/ Packages
(/var/lib/apt/lists/anakonda.altervista.org_debian_packages_Packages) - =
stat
(2 No such file or directory)
As instructed on the matplot lib homepage, my sources.list has
deb http://anakonda.altervista.org/debian packages/ deb-src
http://anakonda.altervista.org/debian sources/

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