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





Showing 21 results of 21

From: Fans G. <gnu...@ya...> - 2008年03月20日 23:57:49
<table cellspacing='0' cellpadding='0' border='0' ><tr><td style='font: inherit;'>Hi Mike,thanks for your reply. I tried f=figure() and pylab.close(f), but the figure can not be closed automatically. Seems that <span style="font-weight: bold;">time.sleep(3) </span>doesn't be called until I close the figure manually. The test code is attached below.<br><br>Thanks,<br>Brook<br>&nbsp;<br>==================================<br>from pylab import *<br>from matplotlib import *<br>from pylab import figure, close, show, nx<br>from matplotlib.figure import Figure<br>import time<br><br>x=arange(10)<br>y=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]<br>x2=arange(20)<br>y2=arange(20)<br><br>f=figure()&nbsp;&nbsp;&nbsp; <br>hold(True)<br>plot(x,y)<br>plot(x2,y2)<br>grid()<br>pylab.show()<br>time.sleep(3)<br>pylab.close(f)<br></td></tr></table><br>
 <hr size=1>Looking for last minute shopping deals? <a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping"> 
Find them fast with Yahoo! Search.</a>
From: Christopher B. <Chr...@no...> - 2008年03月20日 23:10:37
Andrew Charles wrote:
> Compiling Matplotlib from source, or easy_installing the egg
>>From the egg:
> ld: in /sw/lib/libJPEG.dylib, file is not of required architecture for
hmm -- odd, I wouldn't think the egg should be linked against what looks 
like a macports libJPEG -- are you sure it isn't trying to build the 
egg when you easy_install?
> And from source:
> ld: in /sw/lib/libJPEG.dylib, file is not of required architecture for
> architecture ppc
It's trying to link against a macports libJPEG. However, macports 
doesn't build universal binaries, and the MacPython tries to build them, 
and hence the problem.
I'd try to find another libJPEG -- The UnixImageIO Frameworks form 
KyngChaos are a good choice, though I don't know off the top of my head 
how to get MPL to find them.
http://www.kyngchaos.com/wiki/software:frameworks
-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: Chris W. <ch...@si...> - 2008年03月20日 23:03:34
Michael Droettboom wrote:
>> That's cool'n'all, but when is svn going to make it into a Windows 
>> binary release? ;-)
>> 
> I suspect your question is somewhat rhetorical, but... it will probably 
> be a while ;) 
Why is that? Who cranks out the binary releases on Windows and what 
compiler do they use?
> I know a lot of people (myself included) have had success with MinGW. 
What's the "official" compiler used, though?
> It's a good learning experience, and there's lots on this list willing 
> to help. If we can get more SVN Windows users on board, more crazy 
> Windows-only bugs will get found and squashed sooner... ;)
Well, tell me how to get the svn trunk and how to compile and I'll give 
it a go :-)
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 23:01:55
[re-adding in the list]
Eric Firing wrote:
> It looks like you have hit a bug that has been fixed. I don't know when 
> it was fixed, but your example works with svn.
As I said elsewhere, with all the fixes, maybe it's time for a new 
release? ;-)
> Also, you can call bar repeatedly; I think it will just keep adding the 
> new bars, resizing the plot as needed. Everything has to be done before 
> the show() command, though. 
I don't think I was clear enough.. I want to do all the plotting at one 
time, but looking at the example, it appears that you have to do much 
more work as a user if you want bar charts where the bars are 
side-by-side than if you use a line plot.
Are bar charts a relatively new addition? They feel less slick to use 
than the other options :-S
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 22:59:27
Eric Firing wrote:
> If you are referring to scripts in the matplotlib/examples/ subdirectory 
> then you must have a version in which some of those scripts had not been 
> brought up to date with the rest of matplotlib. 
You should turn them into unit tests as well as examples.
I'm about to try and do this, time permiting, for xlwt (small plug - 
it's great for generating formatted excel files from raw data, just as 
xlrd is for extracting data and formatting from excel files, sadly, 
neither can do charting with excel, which is why I'm learning to love 
and hate numpy and matplotlib ;-) )
Out of interest, does MPL have unit tests? It should ;-)
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 22:56:23
Eric Firing wrote:
> In general, I don't think mpl is threadsafe at all; it uses global 
> variables, such as all the rc parameters, that could easily be modified 
> by one thread while being used by another. 
Yep, I guessed as much, BFL it is then ;-)
> I think that great care 
> would be needed if one wanted to have multiple threads making plots. 
> Having one plotting thread and any number of threads doing other things, 
> however, should be OK.
Out of interest, how does one tell MPL to "start a new figure and forget 
everything that's gone before"?
> At the very least, I think we would have to take all the global state 
> information and put it in a class instance, so there could be multiple 
> plotting machines. 
Yes.
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 22:55:01
Michael Droettboom wrote:
> At least the Agg backend *looks* to be reasonably threadsafe -- there 
> are no obvious gotchas like global variables etc. Note, though, that 
> multithreading may not gain much in the way of performance since the 
> global interpreter lock is never released around long-running C blocks.
It's not performance I'm looking for, it's making sure that MPL apps 
served from multi-threaded wsgi servers don't screw each others charts 
up ;-)
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 22:53:57
Giorgio F. Gilestro wrote:
> 
> import numpy as np
> a = ['','','',1.1,2.2]
> mask_a = [i == '' for i in a]
> b = np.ma.MaskedArray(a, mask=mask_a)
Not very efficient, though, is it?
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月20日 22:53:29
Eric Firing wrote:
> Both with respect to documentation and functionality, what you are 
> encountering is the historical aspect of masked arrays as a tacked-on 
> part of python numeric packages, and of matplotlib.
*sigh* I feel lucky ;-)
> Support and 
> integration are improving, but still far from perfect. 
I wish I could help, but my knowledge is lacking...
> Now with respect to your particular case here, trying to plot a filled 
> line with gaps: poly_between has no notion of masked arrays at present. 
> If it did, how should it behave? 
Well, what I actually settled on was juat doing using:
my_masked_array.filled(0)
...to plot with.
> At the very least, additional 
> arguments are needed to specify what should happen for fill-type 
> plotting with missing values. 
Indeed, what I personally would have liked was a complete gap where the 
data is missing, but I guess that would have to return multiple 
polygons, and I don't know how that would work?
> provide them in mpl. I would be happy to fix this gap in mpl's handling 
> of gappy data, 
...heh ;-)
> but I can't make it a priority use of my time right now.
No, I understand :-)
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Andrew C. <ac...@gm...> - 2008年03月20日 22:14:58
Hi Folks,
I'm having some trouble installing Matplotlib on a Macbook pro running Leopard.
I installed macpython 2.5.2, and I have numpy and scipy installed from
source for the 2.5.2 installation.
Compiling Matplotlib from source, or easy_installing the egg
(matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg) both fail with the same
error:
>From the egg:
-------------------------------------------------------------------
........
ld: in /sw/lib/libJPEG.dylib, file is not of required architecture for
architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccG9WQI9.out (No such file or directory)
error: Setup script exited with error: command 'g++' failed with exit status 1
Exception exceptions.OSError: (2, 'No such file or directory',
'src/image.cpp') in <bound method CleanUpFile.__del__ of
<setupext.CleanUpFile instance at 0x1b5f4b8>> ignored
Exception exceptions.OSError: (2, 'No such file or directory',
'src/transforms.cpp') in <bound method CleanUpFile.__del__ of
<setupext.CleanUpFile instance at 0x1b5ccd8>> ignored
Exception exceptions.OSError: (2, 'No such file or directory',
'src/backend_agg.cpp') in <bound method CleanUpFile.__del__ of
<setupext.CleanUpFile instance at 0x1b5f030>> ignored
--------------------------
And from source:
----------------------
...
building 'matplotlib.ft2font' extension
g++ -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
-bundle -undefined dynamic_lookup
build/temp.macosx-10.3-i386-2.5/src/ft2font.o
build/temp.macosx-10.3-i386-2.5/src/mplutils.o
build/temp.macosx-10.3-i386-2.5/CXX/cxx_extensions.o
build/temp.macosx-10.3-i386-2.5/CXX/cxxsupport.o
build/temp.macosx-10.3-i386-2.5/CXX/IndirectPythonInterface.o
build/temp.macosx-10.3-i386-2.5/CXX/cxxextensions.o -L/usr/X11/lib
-L/usr/local/lib -L/usr/lib -L/sw/lib -L/usr/X11R6/lib -lfreetype -lz
-lstdc++ -lm -o build/lib.macosx-10.3-i386-2.5/matplotlib/ft2font.so
-Wl,-framework,CoreServices,-framework,ApplicationServices
ld: in /sw/lib/libJPEG.dylib, file is not of required architecture for
architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccMIVHPU.out (No such file or directory)
error: command 'g++' failed with exit status 1
------------------
Has anyone else hit up against this before. Do I need to update
libJPEG, or modify setup.py?
Cheers,
-------------------------
Andrew Charles
From: Michael H. <mh...@us...> - 2008年03月20日 22:02:49
I think f = figure();
...
pylab.close(f);
should work.
--Mike
On Mar 20, 2008, at 2:14 PM, Fans Gnu wrote:
> Hi All,
>
> I am using matplotlab to plot some figure. I would like to close 
> the figure after show it 5 sec. My code is pasted below. However, I 
> can not close the figure automatically. Can anyone help me to fix it?
>
> Thanks,
> Brook
>
> ==========================
> import time
> from pylab import *
> from matplotlib import *
> x=**
> y=**
> x2=**
> y2=***
> figure()
> hold(True)
> plot(x,y)
> plot(x2,y2,'g^')
> axis([0, 100, 0, 100])
> title('Pylab plot')
> xlabel('X')
> ylabel('Y')
> grid()
> pylab.show()
> time.sleep(5)
> pylab.close()
>
>
> Looking for last minute shopping deals? Find them fast with Yahoo! 
> Search.
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------
Michael Hearne
mh...@us...
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
------------------------------------------------------
From: Fans G. <gnu...@ya...> - 2008年03月20日 20:14:35
<table cellspacing='0' cellpadding='0' border='0' ><tr><td style='font: inherit;'>Hi All,<br><br>I am using matplotlab to plot some figure. I would like to close the figure after show it 5 sec. My code is pasted below. However, I can not close the figure automatically.&nbsp; Can anyone help me to fix it?<br><br>Thanks,<br>Brook<br><br>==========================<br>import time<br>from pylab import *<br>from matplotlib import *<br>x=**<br>y=**<br>x2=**<br>y2=***<br>figure()<br>hold(True)<br>plot(x,y)<br>plot(x2,y2,'g^')<br>axis([0, 100, 0, 100])<br>title('Pylab plot')<br>xlabel('X')<br>ylabel('Y')<br>grid()<br>pylab.show()<br>time.sleep(5)<br>pylab.close()<br><br></td></tr></table><br>
 <hr size=1>Looking for last minute shopping deals? <a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping"> 
Find them fast with Yahoo! Search.</a>
From: Rich S. <rsh...@ap...> - 2008年03月20日 19:21:33
On 2008年3月20日, Eric Firing wrote:
> Sorry, but those options are not presently available at the rc level. Mpl 
> simply does not have easy support for that style of plot. It is on the wish 
> list.
Eric,
 I'm surprised because this is quite common ... at least in my needs over
the years.
> To get rid of the upper and right sides of the box I think you would have
> to do something like "box('off')" and then use hline and vline calls or
> methods to manually put in the lower and left boundaries.
 I use:
 p.p.box(on=False)
 p.axhline(linewidth=1, xmin=0, color='black')
 p.axvline(linewidth=1, ymin=0, color='black')
but the frameless display now has negative values (x = -10, y = -0.2) when
the scales should be x = [0, 50] and y = [0.0, 1.0].
 I want to learn how to get these correct before addressing the grid lines.
Actually, I can turn off the grid lines and use axhline for each one I want.
Thanks,
Rich
-- 
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
From: Eric F. <ef...@ha...> - 2008年03月20日 18:44:35
Rich Shepard wrote:
> I've read the users guide and API (both as pdf and on the web site), and
> do not see how to configure the axes for only left and bottom, and the grid
> for only horizontal lines.
> 
> The axes(rect, w) is used to specify the position of the left and bottom
> lines plus the width and height of the box. What do I put in
> ~/.matplotlib/matplotlibrc to specify no top or right axes, and no vertical
> grid lines?
> 
> Rich
> 
Sorry, but those options are not presently available at the rc level. 
Mpl simply does not have easy support for that style of plot. It is on 
the wish list.
Here is one way of turning off vertical grid lines:
xgl = ax.xaxis.get_gridlines()
for l in gl:
 l.set_visible(False)
To get rid of the upper and right sides of the box I think you would 
have to do something like "box('off')" and then use hline and vline 
calls or methods to manually put in the lower and left boundaries.
Eric
From: Rich S. <rsh...@ap...> - 2008年03月20日 16:50:50
On 2008年3月20日, Rich Shepard wrote:
> Clue appreciated.
 Bingo! Found the problem.
 The plotting functions are in a separate module, and each was developed
interactively using ipython, then copied into the module. As a result, each
function retained the show() command at the end, and that was interfering
with the intent of the programmatic generation.
 Commenting out the p.show() command removes the display, but the stored
.png is there. Whew!
Rich
-- 
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
From: Rich S. <rsh...@ap...> - 2008年03月20日 16:30:37
 I've read the users guide and API (both as pdf and on the web site), and
do not see how to configure the axes for only left and bottom, and the grid
for only horizontal lines.
 The axes(rect, w) is used to specify the position of the left and bottom
lines plus the width and height of the box. What do I put in
~/.matplotlib/matplotlibrc to specify no top or right axes, and no vertical
grid lines?
Rich
-- 
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
From: Rich S. <rsh...@ap...> - 2008年03月20日 16:27:15
On 2008年3月19日, Rich Shepard wrote:
> When it runs in the test script the first curve is plotted in a
> matplotlib window and the program pauses until I close that window by
> clicking on the upper right button on the frame. Then this traceback is
> displayed:
 Update:
 I stripped the test data file down to a single plot's worth. Tried
different tuples in the data so different plotting functions were called. I
have pylab.hold(True) as the first statement in the for loop, and now --
with the single plot data -- there is no error trace.
 However, the code still displays the first curve of the three until I
manually close the matplotlib display window. Then the code proceeds to open
a new window and draw all three curves, then close itself after the save()
command.
 I've no idea how to clean up the drawing of the first curve and the pause
until that window is manually closed. Nothing I've read in the docs or on
the web site give me any clues.
 Clue appreciated.
Rich
-- 
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
From: Ted D. <ted...@jp...> - 2008年03月20日 15:11:33
Thanks! I had originally just tried it (ignoring the docs) but my plot just
showed dots instead of markers for both 'x' and '+'. Then I read the docs
which seemed to indicate they wouldn't work.
Late last night I was digging through axes.py and noticed that they should
be supported (and I found the scatter example that uses them). My problem
was that the point scale input needed to be 3-4 times larger than the
default value for the marker to be visible. Once I changed that, everything
worked fine.
Thanks for the doc patch - that will help everyone else in the future...
Ted
> -----Original Message-----
> From: Manuel Metz [mailto:mm...@as...]
> Sent: Thursday, March 20, 2008 1:13 AM
> To: Ted Drain
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] Efficient scatter() w/ markers from
> plot()?
> 
> Ted Drain wrote:
> > I need to efficiently plot a set of x,y points where each point has a
> > different color. I tried multiple calls to plot() with a single
> point each
> > but that is way too slow. I switched to using scatter() and passing
> in a
> > list of colors which works great. However, I'd really like to have
> the
> > marker options from plot() (things like '+' and 'x') which don't work
> w/
> > scatter.
> >
> > What's the easiest way to get the markers from plot() with the
> efficiency
> > (and multi-colors) from scatter?
> >
> > Thanks,
> > Ted
> >
> 
> Hi Ted,
> oh - you can use '+' and 'x' and many more markers with scatter. It's
> unfortunately just not documented in the current release but is fixed
> in
> the repository.
> 
> pylab.scatter(x,y, marker=(4,2))
> 
> gives a '+', and
> 
> pylab.scatter(x,y, marker=(4,2,math.pi/4.))
> 
> gives a 'x'. The logic is a follows:
> 
> marker(numside, type, angle)
> 
> numside is the number of edges, i.e. 4 for a plus or a cross.
> 
> type : 0 -> a filled symbol,
> 1 -> a star-like symbol,
> 2 -> a asterisk like symbol
> 
> angle: the symbol gets rotated by this angle
> 
> So in principle with this you can produce an endless number of
> different
> markers... :-)
> 
> Manuel
> 
> --
> ---------------------------------------
> Manuel Metz ............ Stw@AIfA
> Argelander Institut fuer Astronomie
> Auf dem Huegel 71 (room 3.06)
> D - 53121 Bonn
> 
> E-Mail: mm...@as...
> Web: www.astro.uni-bonn.de/~mmetz
> Phone: (+49) 228 / 73-3660
> Fax: (+49) 228 / 73-3672
> ---------------------------------------
From: Manuel M. <mm...@as...> - 2008年03月20日 08:12:53
Ted Drain wrote:
> I need to efficiently plot a set of x,y points where each point has a
> different color. I tried multiple calls to plot() with a single point each
> but that is way too slow. I switched to using scatter() and passing in a
> list of colors which works great. However, I'd really like to have the
> marker options from plot() (things like '+' and 'x') which don't work w/
> scatter.
> 
> What's the easiest way to get the markers from plot() with the efficiency
> (and multi-colors) from scatter?
> 
> Thanks,
> Ted
> 
Hi Ted,
oh - you can use '+' and 'x' and many more markers with scatter. It's 
unfortunately just not documented in the current release but is fixed in 
the repository.
 pylab.scatter(x,y, marker=(4,2))
gives a '+', and
 pylab.scatter(x,y, marker=(4,2,math.pi/4.))
gives a 'x'. The logic is a follows:
 marker(numside, type, angle)
numside is the number of edges, i.e. 4 for a plus or a cross.
type : 0 -> a filled symbol,
 1 -> a star-like symbol,
 2 -> a asterisk like symbol
angle: the symbol gets rotated by this angle
So in principle with this you can produce an endless number of different 
markers... :-)
Manuel
-- 
---------------------------------------
 Manuel Metz ............ Stw@AIfA
 Argelander Institut fuer Astronomie
 Auf dem Huegel 71 (room 3.06)
 D - 53121 Bonn
 E-Mail: mm...@as...
 Web: www.astro.uni-bonn.de/~mmetz
 Phone: (+49) 228 / 73-3660
 Fax: (+49) 228 / 73-3672
---------------------------------------
From: Ted D. <ted...@jp...> - 2008年03月20日 03:30:34
I need to efficiently plot a set of x,y points where each point has a
different color. I tried multiple calls to plot() with a single point each
but that is way too slow. I switched to using scatter() and passing in a
list of colors which works great. However, I'd really like to have the
marker options from plot() (things like '+' and 'x') which don't work w/
scatter.
What's the easiest way to get the markers from plot() with the efficiency
(and multi-colors) from scatter?
Thanks,
Ted
From: Rich S. <rsh...@ap...> - 2008年03月20日 01:43:58
 Here is the relevant code fragment:
 	for i in range(1, compList[0][16]):
 pylab.hold(True)
 if compList[0][4] == 'Decay S-Curve':
 testFunctions.zCurve(compList[0][10],compList[0][9])
 elif compList[0][4] == 'Bell Curve':
 testFunctions.gaussCurve(compList[0][14],compList[0][14])
 elif compList[0][4] == 'Growth S-Curve':
 testFunctions.sCurve(compList[0][8],compList[0][11])
 elif compList[0][4] == 'Beta':
 	 testFunctions.betaCurve(compList[0][13],compList[0][12],compList[0][14])
 elif compList[0][4] == 'Data':
 continue
 elif compList[0][4] == 'Linear Increasing':
 testFunctions.linearIncrCurve(compList[0][8],compList[0][11])
 elif compList[0][4] == 'Linear Decreasing':
 testFunctions.linearDecrCurve(compList[0][10],compList[0][9])
 elif compList[0][4] == 'Left Shoulder':
 	 testFunctions.leftShoulderCurve(compList[0][10],compList[0][11],compList[0][9])
 elif compList[0][4] == 'Trapezoid':
 	 testFunctions.trapezoidCurve(compList[0][8],compList[0][10],compList[0][11],compList[0][9])
 elif compList[0][4] == 'Right Shoulder':
 	 testFunctions.rightShoulderCurve(compList[0][8],compList[0][10],compList[0][11])
 elif compList[0][4] == 'Triangle':
 	 testFunctions.triangleCurve(compList[0][8],compList[0][13],compList[0][9])
 elif compList[0][4] == 'Singleton':
 testFunctions.singletonCurve(compList[0][13],compList[0][14])
 elif compList[0][4] == 'Rectangle':
 	 testFunctions.rectangleCurve(compList[0][8],compList[0][10],compList[0][11],compList[0][9])
 elif compList[0][4] == 'Outcome':
 testFunctions.outcomeCurve()
 pylab.savefig(curVar+'.png')
 pylab.hold()
 When it runs in the test script the first curve is plotted in a matplotlib
window and the program pauses until I close that window by clicking on the
upper right button on the frame. Then this traceback is displayed:
Traceback (most recent call last):
 File "termset-test-data.py", line 391, in ?
 testCode()
 File "termset-test-data.py", line 388, in testCode
 pylab.hold()
 File "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", line 334, in
hold
 rc('axes', hold=b)
 File "/usr/lib/python2.4/site-packages/matplotlib/pyplot.py", line 74, in
rc
 matplotlib.rc(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line 712,
in rc
 rcParams[key] = v
 File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line 552,
in __setitem__
 cval = self.validate[key](val)
 File "/usr/lib/python2.4/site-packages/matplotlib/rcsetup.py", line 43, in
validate_bool
 raise ValueError('Could not convert "%s" to boolean' % b)
ValueError: Could not convert "None" to boolean
 What I want is to have all curves from 1 to the maximum number (in
compList[0][16]) plotted on the same set of axes, then save that figure and
go on to the next one.
 Is my problem an indentation error at the end of the IF...ELIF tests?
TIA,
Rich
-- 
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Showing 21 results of 21

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