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 results of 339

<< < 1 .. 10 11 12 13 14 > >> (Page 12 of 14)
From: John H. <jdh...@ac...> - 2006年12月08日 15:33:26
>>>>> "Martin" == Martin Richter <law...@gm...> writes:
 Martin> My question now is: Is there a way to avoid using global
 Martin> variables but also avoid an object-oriented programming?
 Martin> In other words: Is it possible to pass e.g. a dictionary
 Martin> containing some information to the function called by the
 Martin> event? The reason for not wanting the object-oriented way
 Martin> is: We want to teach something to students who never
 Martin> programmed before. And to them it would be pretty hard if
 Martin> we start everything object-oriented!
The can use attrs on the function
def two_parts(event):
 if event.button == 3:
 two_parts.program_part = two_parts.program_part%2 + 1
 print " Changed to part to ", program_part
 if two_parts.program_part == 1 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r')
 if two_parts.program_part == 2 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 's', mfc = 'g')
 draw()
two_parts.program_part = 1
which would introduce them to attributes and pave the way to thinking
about OO.
JDH
From: Martin R. <law...@gm...> - 2006年12月08日 14:39:24
Hello everyone,
below is a little code - what it actually does is quite self-explanatory.
(When clicking with left - draw a red circle. When the right button is pressed 
switch to a different mode. Now green squares are drawn and so on.)
My question now is: Is there a way to avoid using global variables but also 
avoid an object-oriented programming? In other words: Is it possible to pass 
e.g. a dictionary containing some information to the function called by the 
event? The reason for not wanting the object-oriented way is: We want to 
teach something to students who never programmed before. And to them it would 
be pretty hard if we start everything object-oriented!
Thanks for your suggestions,
Martin
########################################
from pylab import *
def two_parts(event):
 global program_part
 if event.button == 3:
 program_part = program_part%2 + 1
 print " Changed to part to ", program_part
 if program_part == 1 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 'o', mfc = 'r')
 if program_part == 2 and event.button == 1:
 plot([event.xdata], [event.ydata], marker = 's', mfc = 'g')
 draw()
figure(1)
ax = subplot(111, autoscale_on=False)
ax.set_xlim([0,1])
ax.set_ylim([0,1])
program_part = 1
print " Actual program part is ", program_part
connect('button_press_event', two_parts)
show()
########################################
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/
From: Eric F. <ef...@ha...> - 2006年12月06日 19:48:43
Rob,
This is now in svn, for pcolor only, not for pcolormesh. Please check 
it out. If everything is OK I can add it to pcolormesh as well 
(although pcolormesh still has a deeply-buried bug such that it does not 
work with alpha != 1).
Eric
Robert Hetland wrote:
> 
> I would like to propose expanding the inputs of pcolor to take vectors. 
> Often, you have x and y independent (seperable), and you don't want to 
> go on constructing an x array of redundant values. Actually, in NumPy 
> it is not straightforward to do this with resize if your variable is in 
> the first dimension like time (well, there is meshgrid, but you would 
> only use it for plotting, and with two vectors -- see below). Since 
> NumPy makes such heavy use of array broadcasting, it is not necessary.
> 
> I think MPL should follow the spirit of array broadcasting, and make it 
> such that:
> 
> x = arange(10)
> y = arange(30)
> z = rand(30,10)
> pcolor (x, y, z)
> 
> will work as expected. Perhaps, we could require a NewAxis in the right 
> places, but it would also make sense without. You should also be able to 
> send in just one vector. Consider
> 
> x,y = meshgrid(arange(10), arange(30))
> y = y + random.normal(size=y.shape)
> z = random.random(y.shape)
> pcolor (x, y, z)
> % but x is still essentially just arange(10)
> pcolor(arange(10), y, z)
> 
> What do you all think?
> 
> -Rob.
> 
> 
> -----
> Rob Hetland, Assistant Professor
> Dept of Oceanography, Texas A&M University
> p: 979-458-0096, f: 979-845-6331
> e: he...@ta..., w: http://pong.tamu.edu
> 
From: Tom D. <tom...@al...> - 2006年12月06日 17:11:26
Sorry meant to send this to the whole list:
----------------------------
John,
Thanks for the fix. After reading Eric's email I started to question
my profiling results but I still (without your fix) seem to see a
significant time when in Artist when generating large volumes of
graphs. I need to rebuild my matplotlib against svn and test your fix
now to see if that solves the problem.
Thanks for your help.
--Tom
On 12/5/06, John Hunter <jdh...@ac...> wrote:
> >>>>> "Christopher" == Christopher Barker <Chr...@no...> writes:
>
> Christopher> This sounds like a job for properties! make
> Christopher> _transform a property, and code that gets and sets it
> Christopher> directly should still work. though People that were
> Christopher> accessing an underscored name directly should expect
> Christopher> this kind of problem.
>
> The matplotlib artist kwarg properties act like python properties or
> enthought traits, with some advantages and disadvantages over each
> (mostly disadvantages, alas). We've discussed migrating to one or
> another over the years, but haven't bitten the bullet. At each point
> it's easier to extend the exiting implementation than refactor the
> whole bit; the tyranny of small decisions.
>
> Here are some of the pros and cons as I see them of enthought traits
> vs python properties
>
> Pros:
> * compatibility with the rest of the enthought tool suite
> * built in observer pattern
> * automatic UI for wx users
> * performance is better than python properties last time I looked
> * matplotlib ships with enthought traits built in
>
> Cons:
> * smaller user base than python properties may imply
> fewer 3rd party enhancements, less support, etc
> * we have to maintain our copy of enthought traits to keep it
> current and building or require an additional dependency
>
> I spent some time working on matplotlib rc properties as enthought
> traits as a precursor to porting matplotlib properties to traits.
> Here is some example code showing how to define some representative rc
> properties and construct a matplotlib artist using traits. Because
> matplotlib ships with enthought traits already, you can run this
> script with just matplotlib. Unfortunately, we do not ship the ex UI
> component so you can't test that part. I'm a bit of a traits newbie
> so there are probably better ways to do what I have done below.
>
> import sys, os, re
> import matplotlib.enthought.traits as traits
> from matplotlib.cbook import is_string_like
> from matplotlib.artist import Artist
>
> doprint = True
> flexible_true_trait = traits.Trait(
> True,
> { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
> 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
> } )
> flexible_false_trait = traits.Trait( False, flexible_true_trait )
>
> colors = {
> 'c' : '#00bfbf',
> 'b' : '#0000ff',
> 'g' : '#008000',
> 'k' : '#000000',
> 'm' : '#bf00bf',
> 'r' : '#ff0000',
> 'w' : '#ffffff',
> 'y' : '#bfbf00',
> 'gold' : '#FFD700',
> 'peachpuff' : '#FFDAB9',
> 'navajowhite' : '#FFDEAD',
> }
>
> def hex2color(s):
> "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
> return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
>
> class RGBA(traits.HasTraits):
> # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
> r = traits.Range(0., 1., 0.)
> g = traits.Range(0., 1., 0.)
> b = traits.Range(0., 1., 0.)
> a = traits.Range(0., 1., 1.)
> def __init__(self, r=0., g=0., b=0., a=1.):
> self.r = r
> self.g = g
> self.b = b
> self.a = a
> def __repr__(self):
> return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\
> (self.r, self.g, self.b, self.a)
>
> def tuple_to_rgba(ob, name, val):
> tup = [float(x) for x in val]
> if len(tup)==3:
> r,g,b = tup
> return RGBA(r,g,b)
> elif len(tup)==4:
> r,g,b,a = tup
> return RGBA(r,g,b,a)
> else:
> raise ValueError
> tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
>
> def hex_to_rgba(ob, name, val):
> rgx = re.compile('^#[0-9A-Fa-f]{6}$')
>
> if not is_string_like(val):
> raise TypeError
> if rgx.match(val) is None:
> raise ValueError
> r,g,b = hex2color(val)
> return RGBA(r,g,b,1.0)
> hex_to_rgba.info = 'a hex color string'
>
> def colorname_to_rgba(ob, name, val):
> hex = colors[val.lower()]
> r,g,b = hex2color(hex)
> return RGBA(r,g,b,1.0)
> colorname_to_rgba.info = 'a named color'
>
> def float_to_rgba(ob, name, val):
> val = float(val)
> return RGBA(val, val, val, 1.)
> float_to_rgba.info = 'a grayscale intensity'
>
>
>
> Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA,
> hex_to_rgba, tuple_to_rgba)
>
> def file_exists(ob, name, val):
> fh = file(val, 'r')
> return val
>
> def path_exists(ob, name, val):
> os.path.exists(val)
> linestyles = ('-', '--', '-.', ':', 'steps', 'None')
> TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
> linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
> '+', 'x', 'd', 'D', '|', '_', 'h', 'H',
> 'p', '1', '2', '3', '4',
> TICKLEFT,
> TICKRIGHT,
> TICKUP,
> TICKDOWN,
> 'None'
> )
>
> class LineRC(traits.HasTraits):
> linewidth = traits.Float(0.5)
> linestyle = traits.Trait(*linestyles)
> color = Color
> marker = traits.Trait(*linemarkers)
> markerfacecolor = Color
> markeredgecolor = Color
> markeredgewidth = traits.Float(0.5)
> markersize = traits.Float(6)
> antialiased = flexible_true_trait
> data_clipping = flexible_false_trait
>
> class PatchRC(traits.HasTraits):
> linewidth = traits.Float(1.0)
> facecolor = Color
> edgecolor = Color
> antialiased = flexible_true_trait
>
> timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
> backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg',
> 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg',
> 'WX')
>
> class RC(traits.HasTraits):
> backend = traits.Trait(*backends)
> numerix = traits.Trait('Numeric', 'numarray')
> interactive = flexible_false_trait
> toolbar = traits.Trait('toolbar2', 'classic', None)
> timezone = traits.Trait(*timezones)
> lines = traits.Trait(LineRC())
> patch = traits.Trait(PatchRC())
>
> rc = RC()
> rc.lines.color = 'r'
> if doprint:
> print 'RC'
> rc.print_traits()
> print 'RC lines'
> rc.lines.print_traits()
> print 'RC patches'
> rc.patch.print_traits()
>
>
> class Patch(Artist, traits.HasTraits):
> linewidth = traits.Float(0.5)
> facecolor = Color
> fc = facecolor
> edgecolor = Color
> fill = flexible_true_trait
> def __init__(self,
> edgecolor=None,
> facecolor=None,
> linewidth=None,
> antialiased = None,
> fill=1,
> **kwargs
> ):
> Artist.__init__(self)
>
> if edgecolor is None: edgecolor = rc.patch.edgecolor
> if facecolor is None: facecolor = rc.patch.facecolor
> if linewidth is None: linewidth = rc.patch.linewidth
> if antialiased is None: antialiased = rc.patch.antialiased
>
> self.edgecolor = edgecolor
> self.facecolor = facecolor
> self.linewidth = linewidth
> self.antialiased = antialiased
> self.fill = fill
>
>
> p = Patch()
> p.facecolor = '#bfbf00'
> p.edgecolor = 'gold'
> p.facecolor = (1,.5,.5,.25)
> p.facecolor = 0.25
> p.fill = 'f'
> print 'p.facecolor', type(p.facecolor), p.facecolor
> print 'p.fill', type(p.fill), p.fill
> if p.fill_: print 'fill'
> else: print 'no fill'
> if doprint:
> print
> print 'Patch'
> p.print_traits()
>
>
>
> JDH
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jdh...@ac...> - 2006年12月06日 16:10:08
>>>>> "Pellegrini" == Pellegrini Eric <eri...@ya...> 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()
From: Pellegrini E. <eri...@ya...> - 2006年12月06日 08:32:22
Hi everybody,
I would like to build an application where many filled polygons will have to be displayed on the screen. To do so, I would like to use matplotlib but, up to now, my application is not fast enough.
I use:
python 2.4.1
matplot-0.87.6
numpy-1.0rc1
and I checked my matplotlibrc file, the interactive flag is False.
Here is a little script that illustrates my problem. It takes something like 5-10s to display 80 polygons on the screen using a brand new machine.
###########################################
import pylab
x = range(0,810,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,810,0,610))
########################################
would you have any idea of what is going on or of a better way to implement this ?
Thank you very much
Eric
 		
---------------------------------
 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: John H. <jdh...@ac...> - 2006年12月05日 22:11:21
>>>>> "Christopher" == Christopher Barker <Chr...@no...> writes:
 Christopher> This sounds like a job for properties! make
 Christopher> _transform a property, and code that gets and sets it
 Christopher> directly should still work. though People that were
 Christopher> accessing an underscored name directly should expect
 Christopher> this kind of problem.
The matplotlib artist kwarg properties act like python properties or
enthought traits, with some advantages and disadvantages over each
(mostly disadvantages, alas). We've discussed migrating to one or
another over the years, but haven't bitten the bullet. At each point
it's easier to extend the exiting implementation than refactor the
whole bit; the tyranny of small decisions.
Here are some of the pros and cons as I see them of enthought traits
vs python properties
 Pros:
 * compatibility with the rest of the enthought tool suite
 * built in observer pattern
 * automatic UI for wx users
 * performance is better than python properties last time I looked
 * matplotlib ships with enthought traits built in 
 Cons:
 * smaller user base than python properties may imply
 fewer 3rd party enhancements, less support, etc
 * we have to maintain our copy of enthought traits to keep it
 current and building or require an additional dependency
I spent some time working on matplotlib rc properties as enthought
traits as a precursor to porting matplotlib properties to traits.
Here is some example code showing how to define some representative rc
properties and construct a matplotlib artist using traits. Because
matplotlib ships with enthought traits already, you can run this
script with just matplotlib. Unfortunately, we do not ship the ex UI
component so you can't test that part. I'm a bit of a traits newbie
so there are probably better ways to do what I have done below.
import sys, os, re
import matplotlib.enthought.traits as traits
from matplotlib.cbook import is_string_like
from matplotlib.artist import Artist
doprint = True
flexible_true_trait = traits.Trait(
 True, 
 { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
 } )
flexible_false_trait = traits.Trait( False, flexible_true_trait )
colors = {
 'c' : '#00bfbf',
 'b' : '#0000ff',
 'g' : '#008000',
 'k' : '#000000',
 'm' : '#bf00bf',
 'r' : '#ff0000',
 'w' : '#ffffff',
 'y' : '#bfbf00',
 'gold' : '#FFD700',	
 'peachpuff' : '#FFDAB9',	
 'navajowhite' : '#FFDEAD',	
 }
def hex2color(s):
 "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
 return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
class RGBA(traits.HasTraits):
 # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
 r = traits.Range(0., 1., 0.)
 g = traits.Range(0., 1., 0.)
 b = traits.Range(0., 1., 0.)
 a = traits.Range(0., 1., 1.)
 def __init__(self, r=0., g=0., b=0., a=1.):
 self.r = r
 self.g = g
 self.b = b
 self.a = a
 def __repr__(self):
 return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\
 (self.r, self.g, self.b, self.a)
def tuple_to_rgba(ob, name, val):
 tup = [float(x) for x in val]
 if len(tup)==3:
 r,g,b = tup
 return RGBA(r,g,b)
 elif len(tup)==4:
 r,g,b,a = tup
 return RGBA(r,g,b,a)
 else:
 raise ValueError
tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
def hex_to_rgba(ob, name, val):
 rgx = re.compile('^#[0-9A-Fa-f]{6}$')
 if not is_string_like(val):
 raise TypeError
 if rgx.match(val) is None:
 raise ValueError
 r,g,b = hex2color(val)
 return RGBA(r,g,b,1.0)
hex_to_rgba.info = 'a hex color string'
def colorname_to_rgba(ob, name, val):
 hex = colors[val.lower()]
 r,g,b = hex2color(hex)
 return RGBA(r,g,b,1.0)
colorname_to_rgba.info = 'a named color'
def float_to_rgba(ob, name, val):
 val = float(val)
 return RGBA(val, val, val, 1.)
float_to_rgba.info = 'a grayscale intensity'
Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA,
 hex_to_rgba, tuple_to_rgba)
def file_exists(ob, name, val):
 fh = file(val, 'r')
 return val
def path_exists(ob, name, val):
 os.path.exists(val)
linestyles = ('-', '--', '-.', ':', 'steps', 'None')
TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
 '+', 'x', 'd', 'D', '|', '_', 'h', 'H',
 'p', '1', '2', '3', '4',
 TICKLEFT,
 TICKRIGHT,
 TICKUP,
 TICKDOWN,
 'None'
 )
class LineRC(traits.HasTraits):
 linewidth = traits.Float(0.5) 
 linestyle = traits.Trait(*linestyles)
 color = Color
 marker = traits.Trait(*linemarkers)
 markerfacecolor = Color
 markeredgecolor = Color 
 markeredgewidth = traits.Float(0.5)
 markersize = traits.Float(6) 
 antialiased = flexible_true_trait 
 data_clipping = flexible_false_trait 
class PatchRC(traits.HasTraits):
 linewidth = traits.Float(1.0) 
 facecolor = Color
 edgecolor = Color 
 antialiased = flexible_true_trait 
timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg',
 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg',
 'WX')
class RC(traits.HasTraits):
 backend = traits.Trait(*backends)
 numerix = traits.Trait('Numeric', 'numarray')
 interactive = flexible_false_trait
 toolbar = traits.Trait('toolbar2', 'classic', None)
 timezone = traits.Trait(*timezones)
 lines = traits.Trait(LineRC())
 patch = traits.Trait(PatchRC())
rc = RC()
rc.lines.color = 'r'
if doprint:
 print 'RC'
 rc.print_traits()
 print 'RC lines'
 rc.lines.print_traits()
 print 'RC patches'
 rc.patch.print_traits()
class Patch(Artist, traits.HasTraits):
 linewidth = traits.Float(0.5)
 facecolor = Color
 fc = facecolor
 edgecolor = Color
 fill = flexible_true_trait
 def __init__(self,
 edgecolor=None, 
 facecolor=None,
 linewidth=None,
 antialiased = None, 
 fill=1,
 **kwargs
 ):
 Artist.__init__(self)
 if edgecolor is None: edgecolor = rc.patch.edgecolor
 if facecolor is None: facecolor = rc.patch.facecolor
 if linewidth is None: linewidth = rc.patch.linewidth
 if antialiased is None: antialiased = rc.patch.antialiased
 self.edgecolor = edgecolor
 self.facecolor = facecolor
 self.linewidth = linewidth
 self.antialiased = antialiased 
 self.fill = fill
 
p = Patch()
p.facecolor = '#bfbf00'
p.edgecolor = 'gold'
p.facecolor = (1,.5,.5,.25)
p.facecolor = 0.25
p.fill = 'f'
print 'p.facecolor', type(p.facecolor), p.facecolor
print 'p.fill', type(p.fill), p.fill
if p.fill_: print 'fill'
else: print 'no fill'
if doprint:
 print
 print 'Patch'
 p.print_traits()
JDH
From: Eric F. <ef...@ha...> - 2006年12月05日 19:58:51
John, Tom,
I don't understand how generation of the identity transform for each 
Artist instance could possibly be a significant overall slowdown; it 
should be very fast, and only a small part of the time required to 
actually do anything useful with an Artist instance. I am wondering 
whether this could be a problem with the profiler, not a genuine slowdown.
Eric
John Hunter wrote:
>>>>>> "Tom" == Tom Denniston <tom...@al...> writes:
> 
> Tom> I've been profiling some of my code which builds many
> Tom> somewhat complex graphs. I've noticed that it spends almost
> Tom> all it's time in the __init__ of the artist class. The time
> Tom> there is almost entirely spent on calling identity_transform
> Tom> which builds a SeperableTransform that does no
> Tom> transforming--from what I can tell--which is consistent with
> Tom> the name. The identity transform function buid a bunch of
> Tom> other objects all of which are the same each time. My
> Tom> question is, does it really need to build all these objects
> Tom> over and over again. Given that Artist's __init__ is called
> Tom> by so many things wouldn't it be better to have some static
> Tom> constants to define these default transformation functions?
> Tom> Am I missing something subtle or would this be an
> Tom> improvement?
> 
> I'm hesitant to make a single (shared) identity transform since
> transforms are mutable. But since most objects to not use the
> identity_transform but rather a custom one, we can create it
> lazily. I've implemented these changes in svn. Each artist (as
> before) has a _transform instance but now it defaults to None. Then
> in get_transform
> 
> def get_transform(self):
> 'return the Transformation instance used by this artist'
> if self._transform is None:
> self._transform = identity_transform()
> return self._transform
> 
> The harder part was modifying all of the derived classes that were
> using the _transform attr directly -- all these had to be ported to
> use get_transform instead. The changes are documented in API_CHANGES.
> 
> See if it speeds up your code -- it didn't make an appreciable change
> to backend_driver.
> 
> Note the artist constructor shouldn't be a bottleneck in your python
> script. If it is, you are probably creating lots-o-artists and you
> might be able to use a collection instead. Eg, if you are making
> hundreds or thousands of calls to plot and creating a comparable
> number of Line2D artists, use a LineCollection instead.
> 
> But if you are still experiencing a problem and the changes I made to
> svn don't help (eg if you are creating lots of objects that do require
> the default identity_transform), you can experiment with using a
> single cached identity_transform. Something like
> 
> import matplotlib.artist
> 
> _cached_transform = matplotlib.artist.identity_transform()
> def my_identity_transform():
> return _cached_transform
> matplotlib.artist.identity_transform = my_identity_transform
> 
> # import the rest of mpl here
> 
> 
> 
> Hope this helps...
> 
> JDH
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Christopher B. <Chr...@no...> - 2006年12月05日 19:51:57
John Hunter wrote:
> I'm hesitant to make a single (shared) identity transform since
> transforms are mutable.
Couldn't you make one that was immutable (is that possible in Python)? 
Or even just have a convention that you don't mutate the identity 
transform (though it could be way to late for that now!), kind of like 
how we all no not to assign anything else to the name "None".
> The harder part was modifying all of the derived classes that were
> using the _transform attr directly -- all these had to be ported to
> use get_transform instead.
This sounds like a job for properties! make _transform a property, and 
code that gets and sets it directly should still work. though People 
that were accessing an underscored name directly should expect this kind 
of problem.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jdh...@ac...> - 2006年12月05日 18:36:06
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
 Eric> Hi, I am trying to overplot symbols on a region filled (with
 Eric> pale grey color) between two curves. For some reason the
 Eric> filled region is always ON TOP of the symbols so that I
 Eric> don't see them..
 Eric> (I wanted to use transparency with alpha, but then it is to
 Eric> build a postscript figure which does not support
 Eric> transparency, so this requires me to first plot the filled
 Eric> region and then overplot the symbols...)
 Eric> here is an example:
 Eric> sampVS = arange(0.,1.,0.02) x = concatenate(
 Eric> (sampVS,sampVS[::-1]) ) alpha1 = 0.98486328 alpha2 =
 Eric> 1.28486328 y1 = alpha1 * sampVS / sqrt(1.+(alpha1 *
 Eric> sampVS)**2) y2 = alpha2 * sampVS / sqrt(1.+(alpha2 *
 Eric> sampVS)**2) y = concatenate( (y1,y2[::-1]) ) p = fill(x, y,
 Eric> facecolor=(0.9,0.9,0.9)) scatter([0.4],[0.4])
 Eric> ==> the symbol is hidden behind the filled region although
 Eric> it is plotted afterwards...
scatter (a PatchCollection) and fill (a Polygon) both have a zorder of
1, which means they are drawn at the bottom of the draw hierarchy. We
take all the artists, sort them by zorder, and draw them in order.
You should set the zorder of your scatter to be higher than the zorder
of your fill. Eg
 poly = fill(....)
 col = scatter(...)
 col.set_zorder( 1.1 * poly.get_zorder() )
See also examples/zorder_demo.py
JDH
6 messages has been excluded from this view by a project administrator.

Showing results of 339

<< < 1 .. 10 11 12 13 14 > >> (Page 12 of 14)
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 によって変換されたページ (->オリジナル) /