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

Showing 12 results of 12

From: <kc1...@ya...> - 2007年03月14日 21:16:07
Jouni,=0A=0AAre you certain the version you sent me is correct? It didn't =
make any difference - I get the same error messages.=0A=0ARegards,=0A=0A> -=
----Original Message-----=0A> From: mat...@li...urcefo=
rge.net =0A> [mailto:mat...@li...] On =0A=
> Behalf Of Jouni K. Sepp=E4nen=0A> Sent: Monday, March 12, 2007 11:20 PM=
=0A> To: mat...@li...=0A> Subject: Re: [Matplotli=
b-users] PDF backend problem=0A> =0A> =0A> I fixed another filehandle leak =
in the pdf backend, so here's =0A> a more complete patch. There are also se=
veral cases of =0A> file(...) being passed to pickle.dump or pickle.load in=
 =0A> font_manager.py. I was going to take care of these by writing =0A> so=
me utility functions, but I started wondering why the =0A> import of cPickl=
e or pickle is done only within methods of =0A> FontManager and not at the =
top level. Are there some =0A> platforms where neither is available, or wha=
t is the rationale?=0A> =0A> Index: backend_pdf.py =0A> =3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A> --- backend_pdf.py (revision 304=
4)=0A> +++ backend_pdf.py (revision 3046)=0A> @@ -457,7 +457,9 @@=0A> =
 self.writeObject(self.fontObject, fonts)=0A> =0A> def _w=
rite_afm_font(self, filename):=0A> - font =3D AFM(file(filename))=0A=
> + fh =3D file(filename)=0A> + font =3D AFM(fh)=0A> + =
 fh.close()=0A> fontname =3D font.get_fontname()=0A> font=
dict =3D { 'Type': Name('Font'),=0A> 'Subtype': Name(=
'Type1'),=0A> @@ -1081,7 +1083,9 @@=0A> font =3D self.afm_font_cac=
he.get(key)=0A> if font is None:=0A> filename =3D fon=
tManager.findfont(prop, fontext=3D'afm')=0A> - font =3D AFM(file=
(filename))=0A> + fh =3D file(filename)=0A> + font =
=3D AFM(fh)=0A> + fh.close()=0A> self.afm_font_cach=
e[key] =3D font=0A> return font=0A> =0A> -- =0A> Jouni K. Sepp=E4n=
en=0A> http://www.iki.fi/jks=0A> =0A> =0A> --------------------------------=
------------------------------=0A> -----------=0A> Take Surveys. Earn Cash.=
 Influence the Future of IT=0A> Join SourceForge.net's Techsay panel and yo=
u'll get the =0A> chance to share your opinions on IT & business topics thr=
ough =0A> brief surveys-and earn cash =0A> http://www.techsay.com/default.p=
hp?page=3Djoin.php&p=3Dsourceforge=0A&CID=3DDEVDEV=0A______________________=
_________________________=0AMatplotlib-users mailing list Matplotlib-users@=
lists.sourceforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/matplo=
tlib-users=0A=0A =0A--=0AJohn Henry=0A=0A
From: Eric F. <ef...@ha...> - 2007年03月14日 19:25:56
Peter Melchior wrote:
> Hello everybody,
> 
> First I have to say, how much I appreciate using matplotlib.
> 
> But there are some annoyances. One I stumbled over recently is that histograms
> don't deal with masked arrays properly.
Fixed now in svn.
If you don't want to install from svn, use
hist(data_masked.compressed(), bins)
Eric
> 
> For example:
> 
> from numpy import *
> from pylab import *
> 
> bins = arange(21)
> data_masked = ma.masked_values(bins,10)
> hist(data_masked,bins)
> show()
> 
> This example produces (with maplotlib-0.90.0, numpy-1.0) this message:
> /usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning: Cannot
> automatically convert masked array to numeric because data
> is masked in one or more locations.
> warnings.warn("Cannot automatically convert masked array to "\
> 
> But it shows a histogram with one count per bin although data_masked[10] should
> not be counted.
> 
> When I'm trying "plot(bins,data_masked)", data_masked[10] is left out as expected.
> 
> Am I missing something or are histograms not (yet) suited for handling masked
> arrays?
> 
> Best regards,
> 
> Peter Melchior
> 
> 
> 
> -------------------------------------------------------------------------
> 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: Peter M. <pme...@it...> - 2007年03月14日 17:11:57
Hello everybody,
First I have to say, how much I appreciate using matplotlib.
But there are some annoyances. One I stumbled over recently is that histograms
don't deal with masked arrays properly.
For example:
from numpy import *
from pylab import *
bins = arange(21)
data_masked = ma.masked_values(bins,10)
hist(data_masked,bins)
show()
This example produces (with maplotlib-0.90.0, numpy-1.0) this message:
/usr/lib/python2.4/site-packages/numpy/core/ma.py:604: UserWarning: Cannot
automatically convert masked array to numeric because data
 is masked in one or more locations.
 warnings.warn("Cannot automatically convert masked array to "\
But it shows a histogram with one count per bin although data_masked[10] should
not be counted.
When I'm trying "plot(bins,data_masked)", data_masked[10] is left out as expected.
Am I missing something or are histograms not (yet) suited for handling masked
arrays?
Best regards,
Peter Melchior
From: Antonino I. <tri...@gm...> - 2007年03月14日 17:06:13
Attachments: image.eps.bz2
On 3/14/07, Antonino Ingargiola <tri...@gm...> wrote:
[cut]
> Furthermore I have noted that with "usetex" ticks label are rendered
> differently if they are explicitly set with set_[xy]ticklabels() or
> not. Compare the ytick labels (automatic) and xtick labels (manually
> set) in the attached plot.
Now its attached, provided that attachments can reach the list.
 ~ Antonio
From: Antonino I. <tri...@gm...> - 2007年03月14日 16:55:47
On 3/13/07, John Travers <jt...@gm...> wrote:
> On 13/03/07, Antonino Ingargiola <tri...@gm...> wrote:
[cut]
> > However the only font I know that has the superscript with the minus
> > sign is "DejaVu Sans". Anyone know a serif font (or also another sans
> > font) with all those symbols?
>
> DejaVu Serif appears to, and both FreeSans and FreeSerif from freefont
> project do.
On my system (Ubuntu Dapper, matplotlib 0.87) the fonts DejaVu Sans
and FreeSerif show
the minus superscript in matplotlib plots, while FreeSans and DejaVu
Serif no (they show an empty square).
BTW, FreeSerif is quite good for my needs, thanks :).
> John
Cheers,
 ~ Antonio
PS: John Travers, sorry for the private replies to you too.
From: Antonino I. <tri...@gm...> - 2007年03月14日 16:52:00
T24gMy8xMy8wNywgSm9obiBIdW50ZXIgPGpkaDIzNThAZ21haWwuY29tPiB3cm90ZToKPiBPbiAz
LzEzLzA3LCBBbnRvbmlubyBJbmdhcmdpb2xhIDx0cml0ZW1pb0BnbWFpbC5jb20+IHdyb3RlOgo+
Cj4gPiAxLiBVc2UgdGhlIHVuaWNvZGUgc3RyaW5nOiB4bGFiZWwodSdXYXZlbGVuZ3RoIFvsbV0n
KQo+ID4gMi4gVXNlIG1hdGh0ZXh0OiB4bGFiZWwocickXHJte1dhdmVsZW5ndGggW1xtdSBtXX0k
JykKPiA+IDMuIFVzZSB1c2V0ZXg6IHJjKHRleHQsIHVzZXRleD1UcnVlKSwgeGxhYmVsKHInV2F2
ZWxlbmd0aCBbJFxybXtcbXUgbX0kXScpCj4gPgo+ID4gSSBoYXZlIHNvbWUgcHJvYmxlbSB3aXRo
IGVhY2ggbWV0aG9kIChhbnkgaGludCBpcyBhcHByZWNpYXRlZCkuCj4KPiBXaGF0IGlzIHRoZSBw
cm9ibGVtIHdpdGggbWV0aG9kIDM/CgpUaGUgXG11IGNoYXJhY3RlciBpcyBub3QgaW4gcm9tYW4g
Zm9udCBidXQgaW4gaXRhbGljcywgd2hpbGUgdGhlICdtJwppcyBjb3JyZWN0bHkgc2V0IHRvIHJv
bWFuLiBJbiBsYXRleCBJIHVzZSB0aGUgU0l1bml0cyBwYWNrYWdlIHRvIHdyaXRlCnRoZSB1bml0
cywgc28gdGhlIGZvbnRzIGFyZSBjb3JyZWN0bHkgaW4gcm9tYW4gZXZlbiBpbiBtYXRoCmVudmly
b25tZW50LiBJdCB3b3VsZCBiZSB1c2VmdWwgc29tZXRoaW5nIGxpa2UgdGhhdCBpbiBtYXRwbG90
bGliIHRvby4KSG93ZXZlciBJJ2xsIGJlIGhhcHB5IGV2ZW4gaWYgSSBjb3VsZCB3cml0ZSBncmVl
ayBjaGFyYWN0ZXJzIGluIHJvbWFuCmZvbnRzLgoKTWF5YmUgaXQncyBhIHByb2JsZW0gcmVsYXRl
ZCB0byB0aGUgcGFydGljdWxhciBmb250IHVzZWQuLi4KCkZ1cnRoZXJtb3JlIGZvbnQgcmVuZGVy
aW5nIGl0J3MgYSBiaXQgb2RkOiB0aGUgZm9udHMgYXBwZWFycyB0byBiZQpib2xkZXIgdGhhbiBu
b3JtYWwgQ29tcHV0ZXIgTW9kZXJuIGZvbnRzIHVzZWQgaW4gdGhlIGxhdGV4IGRvY3VtZW50LgpJ
J3ZlIHRyaWVkIHRvIGNoYW5nZSB0aGUgZm9udCB3ZWlnaHQgKGluIG1hdHBsb3RsaWJyYykgd2l0
aG91dCBhbnkKZWZmZWN0LiBPbiB0aGUgY29udHJhcnkgbWF0aHRleHQgc2VlbXMgdG8gdXNlIGEg
Zm9udCBsaWtlIFRpbWVzLCB3aGljaApzaG91bGQgYmUgYm9sZGVyLCBidXQgdGhlIG92ZXJhbGwg
YXNwZWN0IGlzIGxpZ2h0ZXIuCgpIb3cgY2FuIEkgY2hhbmdlIHRoZSBmb250IHVzZWQgYnkgJ21h
dGh0ZXh0JyBvciAndXNldGV4Jz8gQWxsIEkgd2FudAppcyB1c2UgdGhlIHN0YW5kYXJkIGFlIGZv
bnRzIEknbSB1c2luZyBpbiBsYXRleC4KCk1hbnkgdGhhbmtzLgoKPiBKREgKPgoKQ2hlZXJzLAoK
IH4gQW50b25pbwo=
From: Antonino I. <tri...@gm...> - 2007年03月14日 16:42:10
On 3/13/07, Edin Salkovic <edi...@gm...> wrote:
> Hi Antonino,
>
> If your using the version 0.90 (or SVN) of matplotlib you can also use
> mathtext2.
>
> To enable it, put these lines in your matplotlibrc file:
> mathtext.mathtext2 : True
> mathtext.nonascii : FreeSerif.ttf # Or any unicode font
>
> or, you can set it for your particular script:
> rcParams['mathtext.mathtext2'] = True
> rcParams['mathtext.nonascii'] = 'FreeSerif.ttf'
Interesting, I will try it when I have time to fiddle with 0.90
installation (currently I have 0.87, included in ubuntu dapper).
> You can also set:
> mathtext.rm : FreeSerif.ttf # Roman font
> mathtext.it : FreeSerifItalic.ttf # Text italic
> mathtext.tt : FreeMono.ttf # Typewriter (monospaced)
> mathtext.mit : FreeSerifItalic.ttf # Math italic
> mathtext.cal : FreeSansOblique.ttf # Caligraphic
>
> Beware that you have to have the freefonts installed on your system,
> or in the mpl data-dir.
Nice, thanks for the imformation. Do they work in matplotlib 0.87 too?
(In my quick test they do not work).
Currently I'm not able to change mathtext or "usetex" fonts (except
for the font size). The font.serif, font.sans, etc... properties
change only the normal text font.
Furthermore I have noted that with "usetex" ticks label are rendered
differently if they are explicitly set with set_[xy]ticklabels() or
not. Compare the ytick labels (automatic) and xtick labels (manually
set) in the attached plot. You can see also that the title and x axis
label fonts are "boldier" (weightier) than the standard latex Computer
Modern fonts (the difference become evident when the image is included
in a latex document). This effect is what I was talking about in
previous mail.
> Best,
> Edin
Ciao,
 ~ Antonio
PS: Sorry to Edin Salkovic for previous private reply
From: Antonino I. <tri...@gm...> - 2007年03月14日 16:38:07
On 3/13/07, John Travers <jt...@gm...> wrote:
> On 13/03/07, Antonino Ingargiola <tri...@gm...> wrote:
> > 1. This method works ok as far as I choose a unicode font with the
> > greek letters, for example:
> >
> > rcParams['font.serif'] = 'DejaVu Serif'
> >
> > However with unicode strings I'm not able to do exponent and deponent
> > text (i.e cm^-1)
>
> You should be able to do super/subscripts in unicode. For example a
> superscript '-' is unicode 207B. If you haven't already found it you
> should check out:
> http://unicode.org/charts/symbols.html
> for more codes. However, the font you choose must support the unicode
> (most only support a certain subset).
Many thanks. Now I can do superscript and subscript (using GuCharMap I
can search in symbol description so it's easy to find them).
However the only font I know that has the superscript with the minus
sign is "DejaVu Sans". Anyone know a serif font (or also another sans
font) with all those symbols?
Cheers,
 ~ Antonio
PS: Sorry to John Hunter my previous private reply
From: Peter B. <plb...@io...> - 2007年03月14日 14:15:17
Hello:
I am trying to set different colors for both major and minor 
gridlines. In essence, I want the major gridlines
to be slightly darker than the minor ones.
However, using the syntax below, I can only seem to set the 
properties of one of the sets of gridlines at a
time. If I comment out the ax.xaxis.grid() call for the minor grid, 
the major grid color gets set correctly.
However, if I try to set both, as shown below, only the color for the 
minor grid is set.
Is the minor grid overriding the major grid somehow? If so, is there 
another property I need to set somewhere?
Many thanks if anyone can help :-)
 minor_grid_color = '#E6E6E6'
 major_grid_color = '#DCDCDC'
 figure(figsize=(pagewidth, pageheight), frameon=frameon, 
facecolor=facecolor, edgecolor=edgecolor)
 minor_multiple = 900
 major_multiple = 3600
 axes([0.05, 0.05, 0.90, 0.90])
 ax=gca()
 ax.xaxis.set_minor_locator(MultipleLocator(minor_multiple))
 ax.xaxis.set_major_locator(MultipleLocator(major_multiple))
 ax.xaxis.grid(True, which="major", linestyle='-', color=major_grid_color)
 ax.xaxis.grid(True, which="minor", linestyle='-', color=minor_grid_color)
From: David F. <dfo...@il...> - 2007年03月14日 10:49:08
On Tue, 2007年03月13日 at 18:05 +0200, Jouni K. Sepp=C3=A4nen wrote:
> David Fokkema <dfo...@il...> writes:
>=20
> > basically a horizontal cumulative histogram, apart from the fact that
> > the plot should be rotated 90 degrees counter-clockwise.
>=20
> Does hist(..., orientation=3D'horizontal') look right?
It's right there in help(hist)! Must've been tired or something, ;-)
Thank you very much!
http://procyon.homeunix.net/~dfokkema/plot-matplotlib-070314.png
David
From: Marcel O. <m.o...@iu...> - 2007年03月14日 08:18:18
Werner Hoch writes:
 > What is Tex output? Do you mean postscript or eps?
 > 
 > > sh: line 1: 11319 Segmentation fault gs -dBATCH -dNOPAUSE
 > > -r6000 -sDEVICE=pswrite -sPAPERSIZE=letter
 > > -sOutputFile="/tmp/ef684d47fbac423478eccceef602c8ca.ps"
 > > "/tmp/ef684d47fbac423478eccceef602c8ca"
 > > >"/tmp/ef684d47fbac423478eccceef602c8ca.output"
OK, so I have updated to the latest RPMs and investigated a bit
further. The gs segfault occurs when setting "usetex=True" AND trying
to save to an eps figure.
Demonstration: take tex_demo.py from the examples collection on the
matplotlib site. It runs OK. Now change savefig('tex_demo') to
savefig('tex_demo.eps'). Boom.
Probably a bug with the Suse gs rather than matplotlib, but pretty
annoying anyway because one would like to produce eps rather than
bitmapped figures for publication quality images.
 > Can you please provide some informations about your setup?
 > OS = SuSE 10.2
 > arch = i586
python shell = ipython or even the standard python interpreter
 > backend your trying to use (Agg is default, set it to TkAgg if you like 
 > to use matplotlib interactively)
 > interactive value in matplotlibrc
OK, here is the problem. With the latest RPM I get
moliver@tlabterm:~/Desktop/examples> ipython -pylab
[Lots of backtrace...]
ImportError: No module named wx
Missing dependency? In any case, after setting the backend to GTKAgg
in matplotlibrc, everything works. I believe that's also the default
in the Fedora RPM.
The following tests with GTKAgg backend setting:
 > Minimum Testcode for matplotlib:
 > -------
 > from pylab import *
 > 
 > a = arange(0,10,0.01)
 > plot(a, sin(a))
 > grid()
 > savefig("abc.png")
 > -------
 > Does it work?
Yes.
 > Testcode for postscript:
 > -------
 > from pylab import *
 > 
 > a = arange(0,10,0.01)
 > plot(a, sin(a))
 > grid()
 > savefig("abc.ps")
 > -------
 > Does it work?
Yes.
OK, so boiled the problem with usetex=True down to the following pair
of working vs. nonworking code. Wierd.
File working.py:
================
#!/usr/bin/env python
from pylab import *
 
rc('text', usetex=True)
a = arange(0,10,0.01)
plot(a, sin(a))
grid()
savefig("abc.ps")
show()
File nonworking.py:
===================
#!/usr/bin/env python
from pylab import *
 
rc('text', usetex=True)
a = arange(0,10,0.01)
plot(a, sin(a)+2)
savefig("abc.ps")
show()
 > After changing the settings for the backend and interactive mode.
 > Does the following code produce a plot when entered into a shell?
 > ---------
 > from pylab import *
 > plot([1,2,3,3,2,3])
 > ---------
As descibed above, changing backend is necessary to do anything...
Did not systematically try all the backends. Would be nice if the
default was working.
 > Can you provide the version of your Fedora and the Version of the 
 > matplotlib package?
 > It would be much easier to track the differences and fix the package.
http://mirrors.usc.edu/pub/linux/distributions/fedora/extras/6/SRPMS/python-matplotlib-0.87.7-3.fc6.src.rpm
Thanks a lot,
Marcel
From: Bill B. <wb...@gm...> - 2007年03月14日 05:49:04
Howdy Folks,
I was missing the good ole days of using Matlab back at the Uni when I
could debug my code, stop at breakpoints and plot various data without
fear of blocking the interpreter process.
Using "ipython -pylab" is what has been suggested to me in the past,
but the problem is I don't do my debugging from ipython. I have a
very nice IDE that works very well, and it has a lovely interactive
debugging prompt that I can use to probe my code when stopped at a
breakpoint. It's great except I can't really use matplotlib for
debugging there because it causes things to freeze up.
So I've come up with a decent (though not perfect) solution for
quickie interactive plots which is to run matplotlib in a separate
process. I call the result it 'ezplot'. The first alpha version of
this is now available at the Cheeseshop. (I made an egg too, so if
you have setuptools you can do "easy_install ezplot".)
The basic usage is like so:
 In [1]: import ezplot
 In [2]: p = ezplot.Plotter()
 In [3]: p.plot([1,2,3],[1,4,9],marker='o')
 Connecting to server... waiting...
 connected to plotserver 0.1.0a1 on http://localhost:8397
 Out[3]: True
 In [4]: from numpy import *
 In [5]: x = linspace(-5,5,20)
 In [13]: p.clf()
 Out[13]: True
 In [14]: p.plot(x, x*x*log(x*x+0.01))
(Imagine lovely plots popping up on your screen as these commands are typed.)
The only return values you get back are True (success...probably) or
False (failure...for sure). So no fancy plot object manipulation is
possible. But you can do basic plots no problem.
The nice part is that this (unlike ipython's built-in -pylab threading
mojo) should work just as well from wherever you're using python.
Whether it's ipython (no -pylab) or Idle, or a plain MS-DOS console,
or WingIDE's debug probe, or SPE, or a PyCrust shell or whatever. It
doesn't matter because all the client is doing is packing up data and
shipping over a socket. All the GUI plotting mojo happens in a
completely separate process.
There are plenty of ways this could be made better, but for me, for
now, this probably does pretty much all I need, so it's back to Real
Work. But if anyone is interested in making improvements to this, let
me know.
Here's a short list of things that could be improved:
* Right now I assume use of the wxAGG backend for matplotlib. Don't
know how much work it would be to support other back ends (or how to
go about it, really). wxAGG is what I always use.
* Returning more error/exception info from the server would be nice
* Returning full fledged proxy plot objects would be nice too, but I
suspect that's a huge effort
* SOAP may be better for this than xmlrpclib but I just couldn't get
it to work (SOAPpy + Twisted).
* A little more safety would be nice. Anyone know how to make a
Twisted xmlrpc server not accept connections from anywhere except
localhost?
* There's a little glitch in that the spawned plot server dies with
the parent that created it. Maybe there's a flag to subprocess.Popen
to fix that?
* Sometimes when you click on "Exit Server", if there are plot windows
open it hangs while shutting down.
Only tested on Win32 but there's nothing much platform specific in there.
Give it a try and let me know what you think!
--bb

Showing 12 results of 12

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