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
|
|
From: <fcc...@fi...> - 2004-09-29 15:51:53
|
On Tuesday 28 September 2004 16:48, John Hunter wrote: > >>>>> "Dirk" == <rep...@we...> writes: > > Dirk> John Hunter: Normally I wouldn't waste bandwith in a > Dirk> mailing-list by sending neither a question nor an answer, > Dirk> but in this case I feel the urge to thank you for your > Dirk> support. Your function does exactly what I need and you even > Dirk> gave a hint on how to implement such functional > Dirk> extensions. On top of that, the answer came an hour after I > Dirk> sent the question :-) > > Your welcome... Hi John, I agree with Dirk on the precision and promptness of your responses to all our questions. I am always learning new things about matplolib (MPL) through theses Q&A exchanges. But since topic of bandwidth usage came up in this thread, for the sake of saving not only Sourceforge's but also JDH's bandwidth, I believe a documentation project for MPL should be started. I understand that you might not want to commit effort to document MPL now, since it's still under pretty intense development. However, starting a Wiki documentation project might be a good idea, since the user community could help by adding short tutorials and recipes derived from their own experience with MPL. Moreover, the wiki could slowly evolve into a full blown documentation project. What do you think? cheers, Flavio --- |
|
From: John H. <jdh...@ac...> - 2004-09-29 15:47:34
|
>>>>> "david" == david Powell <dav...@kc...> writes:
david> When importing this version I find a dependency on PyTz and
david> DateUtil. After inspecting you mail archive I found urls
david> for these packages but as a Windows user I am unable
david> uncompress the DateUtil archive files.
This was a bug in the creation of the windows installer, which should
have included these packages. Grab matplotlib-0.63.1.win32-py2.3.exe
from sf, which was just updated minutes ago after someone alerted me
to this problem off-list.
Sorry for the troubles,
JDH
|
|
From: david P. <dav...@kc...> - 2004-09-29 15:43:13
|
When importing this version I find a dependency on PyTz and DateUtil. After inspecting you mail archive I found urls for these packages but as a Windows user I am unable uncompress the DateUtil archive files. Any thoughts? David |
|
From: John H. <jdh...@ac...> - 2004-09-29 12:54:53
|
>>>>> "John" == John Hunter <jdh...@ac...> writes:
John> setup.py now automatically detects Numeric, numarray or
John> both, and compiles in the appropriate extension code. Thus
John> you can use matplotlib with either or both packages and
John> still get the optimal performance. So it is no longer
John> necessary to set NUMERIX in setup.py, but it is necessary to
John> have the extensions you want compiled available at the time
John> you compile matplotlib. The win32 build is for numarray
John> 1.1.
Todd pointed out to me that the last statement is ambiguous. The
windows installer is for Numeric *and* numarray-1.1. Numeric doesn't
have a version number because all recent versions of Numeric are
binary compatible with one another. numarray gets a version number
because numarray 1.1 is not binary compatible with 1.0 which is not
compatible with 0.9. The numarray guys are hopeful that they have
achieved binary compatibility for future releases with 1.1 , and the
goal is to have a single matplotlib win32 installer that works with
all current Numeric and numarray, rather than what we used to do which
was a different installer for Numeric and each version of numarray.
JDH
|
|
From: Niklas V. <Mit...@we...> - 2004-09-29 06:21:28
|
Hello!
I have tried using matplotlib with pygtk 2.2 and everything worked fine.
But when I try to compile matplotlib (0.62.4) with the newest version of
pygtk, pygtk-2.3.96, I get the error included below. Since this pygtk
version is still in development, this might as well be a bug in pygtk.
Maybe you can help me solve my problem,
Niklas.
--------------------------------------------
building 'matplotlib.backends._gtkagg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/u
sr/local/include -I/usr/include -Isrc -Iagg2/include -I. -I/usr/local/include -I
/usr/include -I/usr/local/include/freetype2 -I/usr/include/freetype2 -Isrc/freet
ype2 -Iagg2/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2 -I/us
r/include/freetype2 -I/usr/local/include -I/usr/include -I/usr/include/pygtk-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/u
sr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X1
1R6/include -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0
/include -I/usr/include/python2.3 -c src/_gtkagg.cpp -o build/temp.linux-i686-2.
3/src/_gtkagg.o -DNUMARRAY
In file included from /usr/include/python2.3/Python.h:8,
from /usr/include/pygtk-2.0/pygobject.h:5,
from src/_gtkagg.cpp:8:
/usr/include/python2.3/pyconfig.h:850:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
from /usr/include/c++/3.3.4/cstring:51,
from src/_gtkagg.cpp:1:
/usr/include/features.h:131:1: warning: this is the location of the previous def
inition
In file included from src/_gtkagg.cpp:8:
/usr/include/pygtk-2.0/pygobject.h:124: error: parse error before `typename'
/usr/include/pygtk-2.0/pygobject.h:131: error: parse error before `typename'
error: command 'gcc' failed with exit status 1
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193
|
|
From: John H. <jdh...@ac...> - 2004-09-29 02:41:32
|
>>>>> "Greg" == Greg Novak <no...@uc...> writes:
Greg> So, I guess the question is does anyone know any neat tricks
Greg> to get this to work?
Ask you friendly neighborhood developer to support this in the hist
signature?
There are a few ways to go here.
1) hist takes an option kwarg n=None which is len(bins) and gives the
counts. If n is not None, use it rather than calling mlab.hist.
In this case, the user would be obliged to pass bins as a sequence
rather than an int. If n is None, call mlab.hist
2) hist takes an optional kwarg func=None. If func is None use
mlab.hist, otherwise call n,bins = func(x, bins, normed); ie func
has the same signature as mlab.hist.
3) matplotlib.axes.Axes.hist (which the matlab interface function
wraps) is just a 5 line function, and one of those lines is calling
mlab.hist - take a look at the src code in axes.py. Once you have
your n, bins from your custom function, you can call bar, just as
hist does. Ie it's so easy to plot a histogram using bar that you
may not need to bother with altering the matplotlib.matlab hist.
I'm happy with any of these. Suggestions welcome.
JDH
|
|
From: John H. <jdh...@ac...> - 2004-09-29 02:32:59
|
>>>>> "Curtis" == Curtis Cooper <cu...@hi...> writes:
Curtis> I reported this bug July 19 for an earlier version of
Curtis> Matplotlib, but it is still relevent through Matplotlib
Curtis> v. 0.62-4:
Could you test this with 0.63 and if the problem persists post a
minimal script that exposes the bug?
Thanks,
JDH
|
|
From: John H. <jdh...@ac...> - 2004-09-29 02:31:38
|
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes:
Peter> when using the GD backed, you can write directly to a
Peter> stream (in your case could be sys.stdout).. the same
Peter> functionality has not been implemented for agg yet (last
Peter> time i checked).. i needed this before, and hacked it up
Peter> for GD in the early days (didn't even have agg back
Peter> then).. i think it would be great to have this implemented
Peter> for agg, but i think noone got around to doing it yet...
Finally I did - long overdue. The agg backend now will print png to
a file object, including sys.stdout.
Give it a whirl...
JDH
|
|
From: Greg N. <no...@uc...> - 2004-09-29 01:19:09
|
In an elaboration of my previous post a few minutes ago about weighted
histograms:
As I see it I have three options in getting matplotlib to draw
weighted histograms:
1) Hack up the source. This is fine but I try not to do it unless I
have to.
2) Define my own function that creates the histogram, then pass it to
some convenient "Plot this as a histogram" function in matplotlib.
3) Try to "force" matplotlib to do what I want be explicitly modifying
its namespace. I do this routinely to add functionality that I
consider to be missing from the packages that I use without
maintaining a local branch of the source. Here's one example:
############################
# Add some stuff to the scipy namespace
import scipy
def lrange(l, h, dex):
"""Log-spaced array"""
return 10**arange(log10(l), log10(h), dex)
scipy.lrange = lrange
In this case I would do something like define my_make_hist() and
my_draw_hist() to do what I want, and then force them into the
matplotlib namespace with:
matplotlib.matlab.hist = my_plot_hist
matplotlib.mlab.hist = my_make_hist
Unfortunately the call to gca() in matplotlib.matlab.hist() seems to
prevent this from working the way I want it to.
So, option 1 is unpalateable but possible, option 2 is out b/c
matplotlib seems to lack such a function, and option 3 is out b/c
matplotlib isn't resolving the function references the way I would
like.
So, I guess the question is does anyone know any neat tricks to get
this to work?
Thanks a bunch,
Greg
|
|
From: Greg N. <no...@uc...> - 2004-09-29 01:07:55
|
I have a request that weighted histograms be added to the "hist"
function. Here's the code to do it (lightly modified from the version
in matplotlib.mlab, with changes commented:
if not iterable(bins):
ymin, ymax = min(y), max(y)
if ymin==ymax:
ymin -= 0.5
ymax += 0.5
bins = linspace(ymin, ymax, bins)
if w is None: # unweighted if weights not
w=ones(length(y)) # specified
idx = argsort(y) # find indicies that will sort the data
sy = take(y,idx) # sort the data
sw = take(w,idx) # sort the weights
n = searchsorted(sy, bins)
n = concatenate([n,[len(y)]])
hist = zeros(len(n)-1) # make the histogram
for i in range(len(hist)): # sum up the weights that fall into
l=n[i] # the range b/t each bin
h=n[i+1] # ...
hist[i] = sum(sw[l:h]) # ...
if normed:
db = bins[1]-bins[0]
return 1/(len(y)*db)*n, bins
else:
return n, bins
Also, I'd be very happy if the (in my opinion totally rediculous)
default of 10 bins were changed to something more reasonable, such as
50 bins. However, that's easy enough for me to change myself.
Thank you,
Greg
|
|
From: Curtis C. <cu...@hi...> - 2004-09-28 20:06:07
|
I reported this bug July 19 for an earlier version of Matplotlib, but it is still relevent through Matplotlib v. 0.62-4: > I have been using the colorbar() method along with pcolor to make image > plots of data. Normally, the colorbar legend is correct. However, when > the range of numbers to plot is less than 1, such as 10^-3 - 2*10^-3, the > colorbar labels just show up as 0.0 on the top and bottom. The key will be to get the tickfmt option into the colorbar() function working properly. Cheers, Curtis |
|
From: John H. <jdh...@ac...> - 2004-09-28 20:03:55
|
What's new in matplotlib-0.63.0 Announce notes with links available at http://matplotlib.sf.net/whats_new.html * image interpolation works properly. I think I have finally and for real this time fixed the image interpolation / edge effect bug. It turns out there was a bug in antigrain (very unusual!) that was just found, fixed, and released. I've incorporated the latest release into matplotlib, and after talking with the Maxim implemented a solution in matplotlib which fixes the edge problem w/o the view lim hack used previously. Basically, I pad the edges of the input image. This is described in more detail in the new examples/image_interp.py. There is still an occasional off by 1 rounding problem that causes a 1 pixel error (this is independent of the interpolation/edge bug). * The dates handling is rewritten from the ground up, and now requires python2.3. It makes extensive use of dateutil for date ticking. All of your old date code will break, but it's an easy port. In particular, note that the date tick location constructors now have a different meaning. See http://matplotlib.sf.net/API_CHANGES, http://matplotlib.sf.net/matplotlib.dates.html, the updated date demos in examples/ and the new dates tutorial at http://matplotlib.sf.net/tutorial.html#dates. * setup.py now automatically detects Numeric, numarray or both, and compiles in the appropriate extension code. Thus you can use matplotlib with either or both packages and still get the optimal performance. So it is no longer necessary to set NUMERIX in setup.py, but it is necessary to have the extensions you want compiled available at the time you compile matplotlib. The win32 build is for numarray 1.1. * new functions xlim, ylim, xticks and yticks to make setting axis limits, tick locations and labels more natural and elegant. * Reorganized all python library code to lib/ subdir * Added print to file handle for backend agg; see examples/print_stdout.py. Useful for webapp servers who want to print to a pipe. * x and y coords are printed in the toolbar on nouse motion in backends gtk* and tkagg (not implemented yet in wx*). You can set the axis attributes ax.fmt_xdata and ax.fmt_ydata with callable functions to control the formatting of the reported coords (default uses the major tick formatter). See examples/coords_report.py and examples/date_demo1.py. * Added axhline, axvline, axhspan and axvspan for plotting lines and rectangles (spans) in mixed data/axes coords. This is useful if for example, you want to provide a threshold line or range where the x range spans the axes (0-1 in axes coords) and the y range is given in data units. See example/axhspan_demo.py. Downloads at https://sourceforge.net/projects/matplotlib/ JDH |
|
From: Peter G. <pgr...@ge...> - 2004-09-28 19:16:10
|
On Tue, 28 Sep 2004 rep...@we... wrote: > I'm trying to create and display graph-plots dynamically by executing python scripts on a http-server using matplotlib to create the plots. Because the plots are only used at the time they are transferred to the http client (i.e. are dumped by a python script to stdout), I have to delete the plot's .png file which has been created by savefig() immediatly after the plot has been transferred. > > For this application, it would be very helpful if a figure (I use agg backend) could be written to stdout instead of having to save it to the filesystem with savefig(). Is there a possibility to do so? Or did someone found an elegant way to handle such a situation? when using the GD backed, you can write directly to a stream (in your case could be sys.stdout).. the same functionality has not been implemented for agg yet (last time i checked).. i needed this before, and hacked it up for GD in the early days (didn't even have agg back then).. i think it would be great to have this implemented for agg, but i think noone got around to doing it yet... > > Thanks, > Dirk > ____________________________________________________ > Aufnehmen, abschicken, nah sein - So einfach ist > WEB.DE Video-Mail: http://freemail.web.de/?mc=021200 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: John H. <jdh...@ac...> - 2004-09-28 17:37:39
|
>>>>> "Dirk" == <rep...@we...> writes:
Dirk> John Hunter: Normally I wouldn't waste bandwith in a
Dirk> mailing-list by sending neither a question nor an answer,
Dirk> but in this case I feel the urge to thank you for your
Dirk> support. Your function does exactly what I need and you even
Dirk> gave a hint on how to implement such functional
Dirk> extensions. On top of that, the answer came an hour after I
Dirk> sent the question :-)
Your welcome...
Dirk> Do I have to dive into the class description at
Dirk> http://matplotlib.sourceforge.net/classdocs.html to get this
Dirk> informations or is there a more user-friendly description of
Dirk> the matplotlib internals?
I think the best way, after studying the examples in the examples
directory of the src distribution, is to read through the code in
axes.py. Almost all of the plotting functions in matplotlib.matlab
are wrappers for axes plotting functions. Eg scatter wraps
matplotlib.Axes.scatter, plot wraps matplotlib.Axes.plot and so on.
Most of the axes plotting functions in turn create the primitive
objects that actually make up the plot. Axes.plot is one of the more
complicated functions, since it does a lot of variable length argument
processing, so it is probably not the best place to start.
If you have a link to the classdocs open, as you read through the axes
code, you can read the docs for the functions that are being called.
JDH
|
|
From: John H. <jdh...@ac...> - 2004-09-28 16:38:38
|
>>>>> "Andrew" == Andrew Straw <str...@as...> writes:
Andrew> The fill() command itself does work if you give it
Andrew> coordinates for a closed polygon. This draws a filled
Andrew> spiral:
Of course (slaps self on forehead). So my example rewritten would be
rewritten using the cleaner
from matplotlib.matlab import *
x1 = arange(0, 2, 0.01)
y1 = sin(2*pi*x1)
y2 = sin(4*pi*x1) + 2
# reverse x and y2 so the polygon fills in order
x = concatenate( (x1,x1[::-1]) )
y = concatenate( (y1,y2[::-1]) )
p = fill(x, y, facecolor='g')
set(p, alpha=0.5)
show()
I took the liberty of adding your example to CVS in the examples
subdir as examples/fill_spiral.py.
Thanks!
JDH
|
|
From: Andrew S. <str...@as...> - 2004-09-28 16:15:27
|
On Sep 28, 2004, at 5:15 AM, John Hunter wrote:
>>>>>> "Dirk" == <rep...@we...> writes:
>
> Dirk> I want to fill the area between two curves with a color
> Dirk> (incl. alpha channel, I use the agg backend). fill() seems
> Dirk> to fill only the area between the x-axis and one curve - at
> Dirk> least I found no way for filling only the area between two
> Dirk> graphs. Is there a way for doing so at all? Or do I have to
> Dirk> use another graphic library for this kind of fill_between()?
>
> All of the matplotlib plot commands create primitive objects
> (lines.Line2D, patches.Rectangle, patches.Polygon, text.Text). If a
> plot command doesn't suit your needs, you can roll your own by
> creating the right kind of primitive object. Here is a fill_between
> implementation
The fill() command itself does work if you give it coordinates for a
closed polygon. This draws a filled spiral:
from matplotlib.matlab import *
from numarray import *
theta = arange(0,8*pi,0.1)
a=1
b=.2
for dt in arange(0,2*pi,pi/2.0):
x = a*cos( theta+dt )*exp(b*theta)
y = a*sin( theta+dt )*exp(b*theta)
dt = dt+pi/4.0
x2 = a*cos( theta+dt )*exp(b*theta)
y2 = a*sin( theta+dt )*exp(b*theta)
xf = concatenate( (x,x2[::-1]) )
yf = concatenate( (y,y2[::-1]) )
p1=fill(xf,yf)
show()
|
|
From: <rep...@we...> - 2004-09-28 16:09:58
|
John Hunter: Normally I wouldn't waste bandwith in a mailing-list by sending neither a question nor an answer, but in this case I feel the urge to thank you for your support. Your function does exactly what I need and you even gave a hint on how to implement such functional extensions. On top of that, the answer came an hour after I sent the question :-) > All of the matplotlib plot commands create primitive objects > (lines.Line2D, patches.Rectangle, patches.Polygon, text.Text). If a > plot command doesn't suit your needs, you can roll your own by > creating the right kind of primitive object. [...] Do I have to dive into the class description at http://matplotlib.sourceforge.net/classdocs.html to get this informations or is there a more user-friendly description of the matplotlib internals? Thanks Dirk ----- Original Message ----- From: "John Hunter" <jdh...@ac...> To: <rep...@we...> Cc: <mat...@li...> Sent: Tuesday, September 28, 2004 2:15 PM Subject: Re: [Matplotlib-users] fill area between two curves? fill_between? > >>>>> "Dirk" == <rep...@we...> writes: > > Dirk> I want to fill the area between two curves with a color > Dirk> (incl. alpha channel, I use the agg backend). fill() seems > Dirk> to fill only the area between the x-axis and one curve - at > Dirk> least I found no way for filling only the area between two > Dirk> graphs. Is there a way for doing so at all? Or do I have to > Dirk> use another graphic library for this kind of fill_between()? > > All of the matplotlib plot commands create primitive objects > (lines.Line2D, patches.Rectangle, patches.Polygon, text.Text). If a > plot command doesn't suit your needs, you can roll your own by > creating the right kind of primitive object. Here is a fill_between > implementation > > from matplotlib.matlab import * > from matplotlib.patches import Polygon > > def fill_between(ax, x, y1, y2, **kwargs): > # add x,y2 in reverse order for proper polygon filling > verts = zip(x,y1) + [(x[i], y2[i]) for i in range(len(x)-1,-1,-1)] > poly = Polygon(verts, **kwargs) > ax.add_patch(poly) > ax.autoscale_view() > return poly > > x = arange(0, 2, 0.01) > y1 = sin(2*pi*x) > y2 = sin(4*pi*x) + 2 > ax = gca() > > p = fill_between(ax, x, y1, y2, facecolor='g') > p.set_alpha(0.5) > show() > > Hope this helps, > JDH > |
|
From: John H. <jdh...@ac...> - 2004-09-28 13:04:37
|
>>>>> "Dirk" == <rep...@we...> writes:
Dirk> I want to fill the area between two curves with a color
Dirk> (incl. alpha channel, I use the agg backend). fill() seems
Dirk> to fill only the area between the x-axis and one curve - at
Dirk> least I found no way for filling only the area between two
Dirk> graphs. Is there a way for doing so at all? Or do I have to
Dirk> use another graphic library for this kind of fill_between()?
All of the matplotlib plot commands create primitive objects
(lines.Line2D, patches.Rectangle, patches.Polygon, text.Text). If a
plot command doesn't suit your needs, you can roll your own by
creating the right kind of primitive object. Here is a fill_between
implementation
from matplotlib.matlab import *
from matplotlib.patches import Polygon
def fill_between(ax, x, y1, y2, **kwargs):
# add x,y2 in reverse order for proper polygon filling
verts = zip(x,y1) + [(x[i], y2[i]) for i in range(len(x)-1,-1,-1)]
poly = Polygon(verts, **kwargs)
ax.add_patch(poly)
ax.autoscale_view()
return poly
x = arange(0, 2, 0.01)
y1 = sin(2*pi*x)
y2 = sin(4*pi*x) + 2
ax = gca()
p = fill_between(ax, x, y1, y2, facecolor='g')
p.set_alpha(0.5)
show()
Hope this helps,
JDH
|
|
From: John H. <jdh...@ac...> - 2004-09-28 12:51:05
|
>>>>> "Alan" == Alan G Isaac <ai...@am...> writes:
Alan> ii. running prepared scripts for prepared graphical
Alan> illustrations. Here I will usually have several figures
Alan> that I want displayed sequentially. With interactive=False,
Alan> this approach seems to work fine: I close a figure and the
Alan> next appears (TKAgg). With interactive=True (and the show
Alan> commands removed), this approach seems to choke with an
Alan> abnormal program termination: Fatal Python Error:
Alan> PyEval_RestoreThread: NULL tstate
What environment / shell / OS are you running in?
Could you send me an example script so I can try it?
Alan> Since I wish to do both, I decided I shd have
Alan> interactive:False in my rc file. Am I overlooking
Alan> something?
ipython is well suited to this task. In the pylab mode, it sets
matplotlib to be in interactive mode in your backend of choice. If
you want to run a matplotlib script from within the interactive
session, type
>>> run somescript.py
and it will transiently set interactive : False for the execution of
the script, and then restore your interactive setting. So perhaps it
will give you the best of both interactive mode and script mode, under
one roof?
JDH
|
|
From: Alan G I. <ai...@am...> - 2004-09-28 12:07:13
|
On Mon, 27 Sep 2004, John Hunter apparently wrote: > But for classroom use, I suggest you just put "interactive > : True" in your rc file and then you have no need for > show. Is there a downside to this approach? I'm not sure. There are two different classroom situations. i. ad hoc drawing in the classroom from a Python shell. Here setting interactive makes good sense, it seems. ii. running prepared scripts for prepared graphical illustrations. Here I will usually have several figures that I want displayed sequentially. With interactive=False, this approach seems to work fine: I close a figure and the next appears (TKAgg). With interactive=True (and the show commands removed), this approach seems to choke with an abnormal program termination: Fatal Python Error: PyEval_RestoreThread: NULL tstate Since I wish to do both, I decided I shd have interactive:False in my rc file. Am I overlooking something? Thanks, Alan |
|
From: <rep...@we...> - 2004-09-28 11:57:24
|
I'm trying to create and display graph-plots dynamically by executing python scripts on a http-server using matplotlib to create the plots. Because the plots are only used at the time they are transferred to the http client (i.e. are dumped by a python script to stdout), I have to delete the plot's .png file which has been created by savefig() immediatly after the plot has been transferred. For this application, it would be very helpful if a figure (I use agg backend) could be written to stdout instead of having to save it to the filesystem with savefig(). Is there a possibility to do so? Or did someone found an elegant way to handle such a situation? Thanks, Dirk ____________________________________________________ Aufnehmen, abschicken, nah sein - So einfach ist WEB.DE Video-Mail: http://freemail.web.de/?mc=021200 |
|
From: <rep...@we...> - 2004-09-28 11:44:09
|
I want to fill the area between two curves with a color (incl. alpha channel, I use the agg backend). fill() seems to fill only the area between the x-axis and one curve - at least I found no way for filling only the area between two graphs. Is there a way for doing so at all? Or do I have to use another graphic library for this kind of fill_between()? -Dirk ________________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193 |
|
From: John H. <jdh...@ac...> - 2004-09-28 10:11:54
|
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes:
Peter> doing this would be to incorporate it into the plot()
Peter> command. Perhaps adding an option 'steps' (following
Peter> gnuplot's convention could have steps equal 'histeps',
Peter> 'fsteps' or just 'steps' - see link above.. None could mean
Peter> regular plot() behavior). I would say this would be the
Peter> most elegant option, but probably would call for John (or
Peter> someone else from the core developers) to make the
Peter> changes. Alternatively we could use above and wrap it in a
Peter> plot_step() function.
Peter> Any interest in this? If so which way do we want to go?
It might be easiest to make this a line style. Then you could use the
builtin kwarg linestyle
plot(x, y, linestyle='steps')
It shouldn't be too hard to modify lines.py to support this. If you
want to take a stab at it, I'd be happy to include it. The nice thing
about making it a line style is that the changes required would all be
contained to the lines.py file which is simple and clear. If you
change how plot processes its arguments, it's easy to foul things up.
The only potential problem I see is this would prevent you from, for
example, having a dashed stepped line, since dash is itself a line
style. But who needs a dashed stepped line, for heaven's sake?
JDH
|
|
From: John H. <jdh...@ac...> - 2004-09-28 09:21:15
|
>>>>> "Tom" == Tom Kornack <to...@ko...> writes:
Tom> Hello: I'm having trouble figuring out how to plot error bars
Tom> on a log log plot. It doesn't seem that loglog takes an
Tom> errorbar keyword. Any pointers?
Hi Tom,
The semilogx, semilogy and loglog plots are thin wrappers around plot
that set the scale of the axes. So you can use a log scale on any
axis that has strictly positive data
from matplotlib.matlab import *
x = arange(10)
y = 1e6*rand(10)+1e5+1
err = 1e5*rand(10)
ax = gca()
errorbar(x,y,err)
ax.set_yscale('log')
show()
See also http://matplotlib.sf.net/examples/log_bar.py .
JDH
|
|
From: Tom K. <to...@ko...> - 2004-09-28 05:08:42
|
Hello: I'm having trouble figuring out how to plot error bars on a log log plot. It doesn't seem that loglog takes an errorbar keyword. Any pointers? Tom Kornack http://kornack.com Fundamental Symmetries Lab, Princeton University 609-716-7259 (h), 609-933-2186 (m), 609-258-0702 (w), 609-258-1625 (f) Thomas Kornack, 157 North Post Road, Princeton Junction, NJ 08550-5009 |