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





Showing 18 results of 18

From: Ted D. <ted...@jp...> - 2005年02月11日 21:46:33
Thanks for all the advice! We're going to start working on this ground 
track plotting package in the March-April time frame so I'm going to save 
off these notes for the implementor. We'll let you know if we need any 
more help then.
Thanks,
Ted
At 01:25 PM 2/11/2005, John Hunter wrote:
> >>>>> "Ted" == Ted Drain <ted...@jp...> writes:
> Ted> For example, if I have a data set that looks like this:
>
> Ted> [155,2] [165,4] [175,6] [-175,8] [-165,10] [-155,12]
>
> Ted> I really need this data to be drawn as two separate lines:
> Ted> [155,2] [165,4] [175,6] [180,7]
>
> Ted> and [-180,7] [-175,8] [-165,10] [-155,12]
>
> Ted> Ideally these two segments should be treated as a single line
> Ted> wherever applicable (legend, style, etc).
>
>Got it -- what comes immediately to mind is for you to create a new
>class derived from Line2D, that contains your 2...N lines as private
>attrs, defines __getattr__ to return the attr of line[0], and calls
>the Line2D parent setattr on each of your contained line instances.
>You can then add this line to the Axes with add_line.
>
>You would have to be a little clever with the get_xdata and get_ydata
>attrs, which are used for autoscaling. If this looks like a good way
>to go, I can help you with it if you want - it could be tricky to get
>just right.
>
>The other possibility would be to setup an observer pattern on the
>line0 properties, such that any changes would be fired off to the
>observers. This is an area where it would be nice to have enthought
>traits built-in, since all trains support observers. As you may have
>noticed on the dev list, this is an area of active discussion.
>
>
> Ted> I'd probably label this as a "mostly acceptable work-around"
> Ted> since it requires generating two data arrays. In my case,
> Ted> the data is expensive to compute so we'd probably have to
> Ted> generate a second array by selectively copying points from
> Ted> the first array which is kind of annoying. I was hoping for
> Ted> a keyword that said how often to generate the markers for an
> Ted> existing line (with the default as one of course). Probably
> Ted> not a huge deal though.
>
>If this becomes a performance problem for you, another idea would be
>to use a marker mask. Eg add an additional property to the line class
>which are the indices at which to write markers.
>
>Currently the line class is hairy in CVS, mainly because it is
>supporting the old and newstyle backend drawing interfaces. The
>newstyle interface has only two renderer methods that it calls
>(draw_lines and draw_markers). It would be fairly easy to subclass
>Line2D to support a marker mask, possibly passing it on as a kwarg to
>the renderer.draw_markers method. One could do it in Numeric a the
>python level; if you are looking for optimal performance, it would be
>barely more than a no-op at the backend level.
>
>
>JDH
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Matplotlib-users mailing list
>Mat...@li...
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Ted Drain Jet Propulsion Laboratory ted...@jp... 
From: John H. <jdh...@ac...> - 2005年02月11日 21:36:38
>>>>> "Ted" == Ted Drain <ted...@jp...> writes:
 Ted> For example, if I have a data set that looks like this:
 Ted> [155,2] [165,4] [175,6] [-175,8] [-165,10] [-155,12]
 Ted> I really need this data to be drawn as two separate lines:
 Ted> [155,2] [165,4] [175,6] [180,7]
 Ted> and [-180,7] [-175,8] [-165,10] [-155,12]
 Ted> Ideally these two segments should be treated as a single line
 Ted> wherever applicable (legend, style, etc).
Got it -- what comes immediately to mind is for you to create a new
class derived from Line2D, that contains your 2...N lines as private
attrs, defines __getattr__ to return the attr of line[0], and calls
the Line2D parent setattr on each of your contained line instances.
You can then add this line to the Axes with add_line.
You would have to be a little clever with the get_xdata and get_ydata
attrs, which are used for autoscaling. If this looks like a good way
to go, I can help you with it if you want - it could be tricky to get
just right.
The other possibility would be to setup an observer pattern on the
line0 properties, such that any changes would be fired off to the
observers. This is an area where it would be nice to have enthought
traits built-in, since all trains support observers. As you may have
noticed on the dev list, this is an area of active discussion.
 Ted> I'd probably label this as a "mostly acceptable work-around"
 Ted> since it requires generating two data arrays. In my case,
 Ted> the data is expensive to compute so we'd probably have to
 Ted> generate a second array by selectively copying points from
 Ted> the first array which is kind of annoying. I was hoping for
 Ted> a keyword that said how often to generate the markers for an
 Ted> existing line (with the default as one of course). Probably
 Ted> not a huge deal though.
If this becomes a performance problem for you, another idea would be
to use a marker mask. Eg add an additional property to the line class
which are the indices at which to write markers. 
Currently the line class is hairy in CVS, mainly because it is
supporting the old and newstyle backend drawing interfaces. The
newstyle interface has only two renderer methods that it calls
(draw_lines and draw_markers). It would be fairly easy to subclass
Line2D to support a marker mask, possibly passing it on as a kwarg to
the renderer.draw_markers method. One could do it in Numeric a the
python level; if you are looking for optimal performance, it would be
barely more than a no-op at the backend level.
JDH
From: Ted D. <ted...@jp...> - 2005年02月11日 21:25:07
Inlined comments below...
At 12:41 PM 2/11/2005, John Hunter wrote:
> >>>>> "Ted" == Ted Drain <ted...@jp...> writes:
>
> Ted> Is there an easy way to plot multiple collections of points
> Ted> connected by a line and have only a single legend entry show
> Ted> up? It would also be nice if any modifications to that entry
> Ted> (marker, color, etc) would affect all the line segments.
>
>Not 100% sure what you are after here. You can control which lines
>and patches get passed to the legend by explicitly passing them (as
>opposed to using the autolegend capabilities). Eg
>
> ax.legend((l1, p1), ('A line, 'A patch')
>
>Also, have you looked into the LineCollection class -- this sounds
>like it would support some of what you are describing. Perhaps if you
>explain a bit more.
What's happening here is that we have a plot that's a map of the earth 
going from -180 to 180 longitude and pole to pole. A spacecraft ground 
trajectory goes around and around so when it hit's the +180 longitude, it 
needs to wrap around to -180. We want this to be a line plot. If you just 
put in the x,y coordinates as a line plot, you get a long line segment when 
it goes from say:
(175,20) -> (-175,30)
What we've done in the past is to use a heuristic to detect this case. For 
example, I might say if the delta x is greater than 90% of the total 
longitude, it's a wrap around case. In that case, I do linear 
interpolation to get a point at the edge of the map (in this case 180, 25), 
insert this point, and split the line into two pieces at this point.
For example, if I have a data set that looks like this:
[155,2]
[165,4]
[175,6]
[-175,8]
[-165,10]
[-155,12]
I really need this data to be drawn as two separate lines:
[155,2]
[165,4]
[175,6]
[180,7]
and
[-180,7]
[-175,8]
[-165,10]
[-155,12]
Ideally these two segments should be treated as a single line wherever 
applicable (legend, style, etc).
> Ted> Ted PS: we also need some way to draw only the n'th marker in
> Ted> a line plot. We plot a lot of trajectories where time is
> Ted> progressing along the line so it's useful to generate the
> Ted> plot using 1 minute data (for example) and then have a marker
> Ted> be displayed every 60'th point.
>
>Look at subplot(211) in examples/subplot_demo.py. There a line is
>plotted with one temporal resolution, and markers are placed along the
>line at subsampled points. Basically two lines are added with
>different sampling frequencies.
>
>Does this suffice?
I'd probably label this as a "mostly acceptable work-around" since it 
requires generating two data arrays. In my case, the data is expensive to 
compute so we'd probably have to generate a second array by selectively 
copying points from the first array which is kind of annoying. I was 
hoping for a keyword that said how often to generate the markers for an 
existing line (with the default as one of course). Probably not a huge 
deal though.
>JDH
Ted Drain Jet Propulsion Laboratory ted...@jp... 
From: John H. <jdh...@ac...> - 2005年02月11日 20:52:27
>>>>> "Ted" == Ted Drain <ted...@jp...> writes:
 Ted> Is there an easy way to plot multiple collections of points
 Ted> connected by a line and have only a single legend entry show
 Ted> up? It would also be nice if any modifications to that entry
 Ted> (marker, color, etc) would affect all the line segments.
Not 100% sure what you are after here. You can control which lines
and patches get passed to the legend by explicitly passing them (as
opposed to using the autolegend capabilities). Eg
 ax.legend((l1, p1), ('A line, 'A patch')
Also, have you looked into the LineCollection class -- this sounds
like it would support some of what you are describing. Perhaps if you
explain a bit more.
 Ted> Ted PS: we also need some way to draw only the n'th marker in
 Ted> a line plot. We plot a lot of trajectories where time is
 Ted> progressing along the line so it's useful to generate the
 Ted> plot using 1 minute data (for example) and then have a marker
 Ted> be displayed every 60'th point.
Look at subplot(211) in examples/subplot_demo.py. There a line is
plotted with one temporal resolution, and markers are placed along the
line at subsampled points. Basically two lines are added with
different sampling frequencies.
Does this suffice?
JDH
From: Ted D. <ted...@jp...> - 2005年02月11日 20:39:50
I could use a scatter plot but user's actually want a line drawn so that's 
out. I think either the plot has to be really smart about it (which is 
probably a bad idea), or this type of functionality has to be in a utility 
or wrapper that can be used. I think I'm stuck doing linear interpolation 
and somehow separating the line segments at the boundary of the map.
Is there an easy way to plot multiple collections of points connected by a 
line and have only a single legend entry show up? It would also be nice if 
any modifications to that entry (marker, color, etc) would affect all the 
line segments.
Ted
PS: we also need some way to draw only the n'th marker in a line plot. We 
plot a lot of trajectories where time is progressing along the line so it's 
useful to generate the plot using 1 minute data (for example) and then have 
a marker be displayed every 60'th point.
At 05:28 AM 2/11/2005, Jeff Whitaker wrote:
>Ted Drain wrote:
>
>>
>>One thing I do need to be able to do is to create line plots that "wrap 
>>around" a map. We generate a lot of ground tracks that use a Mercator 
>>projection covering the whole globe (x=-180->180, y=-90->90) and if the 
>>line goes off one edge, we need to wrap it around to the other edge 
>>instead of drawing a line segment all the way across the page.
>
>Ted: It just occured to me that if you plot the track as a scatterplot of 
>points instead of a line then this is not a problem (i.e. you won't get 
>that line segment running across the page)
>
>-Jeff
>
>--
>Jeffrey S. Whitaker Phone : (303)497-6313
>NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
>325 Broadway Web : http://www.cdc.noaa.gov/~jsw
>Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Matplotlib-users mailing list
>Mat...@li...
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Ted Drain Jet Propulsion Laboratory ted...@jp... 
From: John H. <jdh...@ac...> - 2005年02月11日 20:11:52
>>>>> "Andrew" == Andrew Straw <str...@as...> writes:
 Andrew> I'm no GnuPlot user, but try this:
 Andrew> ax = gca() ax.yaxis.tick_left() ax.xaxis.tick_bottom()
 Yep, that is better than my suggestion. Thanks. It would be nice to
 draw the edges with lines rather than a rectangle so we can turn them
 on and off selectively as well (an detach them...)
JDH
From: John H. <jdh...@ac...> - 2005年02月11日 20:07:19
>>>>> "Robert" == Robert Leftwich <ro...@le...> writes:
 Robert> Does Matplotlib support something equivalent to GnuPlot's
 Robert> nomirror functionality where the x and y axes are only
 Robert> displayed on the bottom and left of the graph and are not
 Robert> 'mirrored' to the top and right?
Not yet, but it's on the goals page at
http://matplotlib.sf.net/goals.html under the "Axis autoranging and
tick customization" section
When "Detachable axis from main axes box and customizable tickline
locations" are implemented, your request will be as well. The problem
is that the edge of the axes is currently drawn as the edge of a
rectangle, not four separate lines. You can, however, turn off the
ticks on the right and top sides
for tick in ax.xaxis.get_major_ticks():
 tick.tick2On = False
See http://matplotlib.sf.net/matplotlib.axis.html for more information
on customizing the axis.
Have fun!
JDH
From: Andrew S. <str...@as...> - 2005年02月11日 20:06:29
Robert Leftwich wrote:
> Does Matplotlib support something equivalent to GnuPlot's nomirror 
> functionality where the x and y axes are only displayed on the bottom 
> and left of the graph and are not 'mirrored' to the top and right?
>
> Robert
I'm no GnuPlot user, but try this:
ax = gca()
ax.yaxis.tick_left()
ax.xaxis.tick_bottom()
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jdh...@ac...> - 2005年02月11日 20:03:33
>>>>> "Robert" == Robert Leftwich <ro...@le...> writes:
 Robert> I wrote:
 >> How can I decrease the size of the actual graph so that the
 >> labels are displayed?
 >> 
 Robert> The answer seems to be to use the following after drawing
 Robert> the graph: ax = gca() ax.set_position([0.2,0.2,0.6,0.6])
 Robert> This was taken from the mailing list discussion on
 Robert> GnuPlot's 'set size ratio' command -
 Robert> (http://sourceforge.net/mailarchive/forum.php?thread_id=5562487&forum_id=33405)
 Robert> Is this the correct approach?
Yep, that's it -- this is also discussed here
http://matplotlib.sf.net/faq.html#TEXTOVERLAP , which also gives
an alternative suggestion.
 Robert> PS One thing that I am having trouble getting my head
 Robert> around fully is how best to handle the coding, i.e. I'd
 Robert> prefer to use the class library approach as I like it's
 Robert> clean, well structured nature, but a number of techniques,
 Robert> such as the above, are written/illustrated using the
 Robert> Pylab/Matlab commands which I find difficult to translate
 Robert> into the class library code. What is the best approach to
 Robert> getting up the learning curve? Are there any problems with
 Robert> mixing the two approaches in the one code base?
It's a common complaint, so don't feel along. Have you seen
examples/pythonic_matplotlib.py -- there is some header documentation
there that offers some pointers. That is an example using the pylab
interface in a more OO way. For pure OO w/o the pylab interface at
all, there is a new example in CVS which I'll put here
 #!/usr/bin/env python
 """
 A pure OO (look Ma, no pylab!) example using the agg backend
 """
 from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
 from matplotlib.figure import Figure
 fig = Figure()
 canvas = FigureCanvas(fig)
 ax = fig.add_subplot(111)
 ax.plot([1,2,3])
 ax.set_title('hi mom')
 ax.grid(True)
 ax.set_xlabel('time')
 ax.set_ylabel('volts')
 canvas.print_figure('test')
My advice, don't be afraid to open up matplotlib/pylab.py to see how
the pylab interface forwards its calls to the OO layer. I appreciate
that "read the source" is not very comforting, but that, the examples
I pointed you too above, the all-too-short Chapter 7 of the user's
guide, the examples/embedding* demos, and the mailing lists, which are
regularly read by many developers, are what we've got right now.
I always encourage new users starting on the path to matplotlib OO API
enlightenment to make notes and write a tutorial as you go. It would
be a useful addition to the documentation.
JDH
From: Robert L. <ro...@le...> - 2005年02月11日 19:19:27
Does Matplotlib support something equivalent to GnuPlot's nomirror functionality 
where the x and y axes are only displayed on the bottom and left of the graph 
and are not 'mirrored' to the top and right?
Robert
From: Robert L. <ro...@le...> - 2005年02月11日 19:18:49
I wrote:
> How can I 
> decrease the size of the actual graph so that the labels are displayed?
> 
The answer seems to be to use the following after drawing the graph:
 ax = gca()
 ax.set_position([0.2,0.2,0.6,0.6])
This was taken from the mailing list discussion on GnuPlot's 'set size ratio' 
command - 
(http://sourceforge.net/mailarchive/forum.php?thread_id=5562487&forum_id=33405)
Is this the correct approach?
Robert
PS One thing that I am having trouble getting my head around fully is how best 
to handle the coding, i.e. I'd prefer to use the class library approach as I 
like it's clean, well structured nature, but a number of techniques, such as the 
above, are written/illustrated using the Pylab/Matlab commands which I find 
difficult to translate into the class library code. What is the best approach to 
 getting up the learning curve? Are there any problems with mixing the two 
approaches in the one code base?
From: Stephen W. <ste...@cs...> - 2005年02月11日 17:54:04
Humufr wrote:
> I would like to know if I'm the only person to have some problem to 
> access to the CVS sourceforge?
 From the Sourceforge status page 
http://sourceforge.net/docman/display_doc.php?group_id=1&docid=2352, you 
can read that access to projects beginning with m, n, p, q, t, y and z 
has been down for 48 hours or so. No estimate as to when it will be 
back up.
From: Humufr <hu...@ya...> - 2005年02月11日 17:02:18
 Hi,
I would like to know if I'm the only person to have some problem to 
access to the CVS sourceforge? I have an error message from the eb 
interface:
502:
"Bad Gateway The proxy server received an invalid response from an 
upstream server."
and:
cvs [login aborted]: unrecognized auth response from 
cvs.sourceforge.net: M PserverBackend::PserverBackend() Connect 
(Connection refused)
Thanks,
Nicolas
From: Humufr <hu...@ya...> - 2005年02月11日 16:45:54
Attachments: fig_bench.png
 Hi,
I did some change (again) in the load function to improve the speed when 
you're load some big data file but you want use only some columns. I did 
all my tests with a file with 9722 line and 16 columns.
The bench test file is after.
I think that the result of the bench are interesting:
I you want use 2 columns on the 16 the results are:
load matplotlib 0.58
load with columns choice 0.27
normal load inside the new load version 0.58
We win a factor two. I know that depend totally from the number of 
columns and that the change is not interesting and more decrease the 
efficiency if you want use all the data in your file but like the 
columns call is optionnal I don't think that is point is crucial but I 
add a figure to see the effect when you go to one to all the columns.
The load function is after.
Regards,
Nicolas
-----------------------------------------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import clock
t3 = clock()
import load_2
Y=load_2.load('data')
x=Y[:,0]
y=Y[:,1]
t4 = clock()
#print t4-t3
#print x,y
col = [0,6]
t1 = clock()
import load_matplotlib
X=load_matplotlib.load('data')
#X = [X[:,i] for i in col]
x=X[:,0]
y=X[:,1]
t2 = clock()
print 'load matplotlib', t2-t1
#print X
t3 = clock()
import load_2
X=load_2.load('data',columns=range(14))
x=Y[:,0]
y=Y[:,1]
t4 = clock()
print 'load with columns choice', t4-t3
t3 = clock()
import load_2
Y=load_2.load('data')
x=Y[:,0]
y=Y[:,1]
t4 = clock()
normal = t4-t3
print 'normal load ', normal
time = []
for i in range(16):
 t3 = clock()
 import load_2
 X=load_2.load('data',columns=range(i))
 x=Y[:,0]
 y=Y[:,1]
 t4 = clock()
 #print 'load with columns choice', t4-t3
 time.append(t4-t3)
from pylab import *
time = array(time)/normal
plot(range(16),time)
xlabel('N columns (total = 16)')
ylabel('time columns /normal time')
show()
------------------------------------------------------------------
def load(fname,comments='%',columns=None):
 """
 Load ASCII data from fname into an array and return the array.
 The data must be regular, same number of values in every row
 fname can be a filename or a file handle.
 A character for to delimit the comments can be use (optional),
 the default is the matlab character '%'.
 An second optional argument can be add, to tell which columns you
 want use in the file. This arguments is a list who contains the
 number of columns beggining by 0 (python style).
 matfile data is not currently supported, but see
 Nigel Wade's matfile ftp://ion.le.ac.uk/matfile/matfile.tar.gz
 Example usage:
 X = load('test.dat') # data in two columns
 t = X[:,0]
 y = X[:,1]
 Alternatively, you can do
 t,y = transpose(load('test.dat')) # for two column data
 X = load('test.dat',[0,2]) # data in two columns (columns 1 and 
3 use in the file)
 X = load('test.dat') # a matrix of data
 
 X = load('test.dat',columns=[2,3]) # a matrix of data, only 
columns 3 and 4 will be use
 
 x = load('test.dat') # a single column of data
 x = load('test.dat,'#') # the character use like a comment 
delimiter is '#'
 """
# from numarray import array
 fh = file(fname)
 X = []
 numCols = None
 if columns is None:
 for line in fh:
 line = line[:line.find(comments)].strip()
 if not len(line): continue
 row = [float(val) for val in line.split()]
 thisLen = len(row)
 if numCols is not None and thisLen != numCols:
 raise ValueError('All rows must have the same number of 
columns')
 X.append(row) 
 else:
 for line in fh:
 line = line[:line.find(comments)].strip()
 if not len(line): continue
 row = [val for val in line.split()]
 row = [float(row[i]) for i in columns]
 thisLen = len(row)
 if numCols is not None and thisLen != numCols:
 raise ValueError('All rows must have the same number of 
columns')
 X.append(row)
 X = array(X)
 r,c = X.shape
 if r==1 or c==1:
 X.shape = max([r,c]),
 return X
 
From: John H. <jdh...@ac...> - 2005年02月11日 15:18:15
>>>>> "John" == John Hunter <jdh...@ac...> writes:
 John> Anyone going to pycon? I'll be giving a talk on matplotlib
 John> on Wednesday --
 John> http://www.python.org/pycon/2005/schedule.html -- and would
 John> enjoy attaching faces to all these posts....
OK, we're official. We have a wiki!
 http://www.python.org/moin/MatplotlibSprint
Add your name to the list of participants if you want to come! Even
if you don't think you're ready to contribute code, stop by and say
hello.
JDH
From: John H. <jdh...@ac...> - 2005年02月11日 14:57:56
Anyone going to pycon? I'll be giving a talk on matplotlib on
Wednesday -- http://www.python.org/pycon/2005/schedule.html -- and
would enjoy attaching faces to all these posts....
A sprint might be fun. It turns out that Monday is the only day I can
do a sprint. We could do something general purpose like picking goals
off the http://matplotlib.sf.net/goals.html page, or highly focused.
A few ideas, but please throw out more ideas
 * contribute to the user's guide
 * support arbitrary clipping paths
 * gradient fills for polygons
 * provide mathtext fonts that don't have the licensing restrictions
 of bakoma, eg the umbellek fonts
 * unicode support / internationalization
 
 * expose latex/tex when available for mathtext rendering
 * expose agg drawing primitives (paths, etc) directly. 
JDH
From: <fcc...@fi...> - 2005年02月11日 14:30:22
hi,
how can I remove a colorbar?
in the following code, i generate figures that are saved not shown. and with 
every new figure I get an extra colorbar instead of an updated one!
from matplotlib.pylab import *
from RandomArray import *
imshow(normal(0,1,(256,256)))
title('distance matrix')
colorbar()
savefig('dm.png')
imshow(normal(0,1,(256,256))+20)
title('conectivity matrix')
colorbar()
savefig('cm.png')
there should be a way to toggle a color bar on and off.
Flávio
From: Jeff W. <js...@fa...> - 2005年02月11日 13:28:36
Ted Drain wrote:
>
> One thing I do need to be able to do is to create line plots that 
> "wrap around" a map. We generate a lot of ground tracks that use a 
> Mercator projection covering the whole globe (x=-180->180, y=-90->90) 
> and if the line goes off one edge, we need to wrap it around to the 
> other edge instead of drawing a line segment all the way across the page.
Ted: It just occured to me that if you plot the track as a scatterplot of points instead of a line then this is not a problem (i.e. you won't get that line segment running across the page)
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

Showing 18 results of 18

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