SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S




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

Showing results of 352

<< < 1 .. 5 6 7 8 9 .. 15 > >> (Page 7 of 15)
From: daniele <dad...@ya...> - 2005年09月15日 16:40:52
hi! i've problems installing matplotlib under debian with packages
provided at mentors.debian.net.
I added these lines to my sources.list :
 deb http://mentors.debian.net/debian unstable main contrib non-free
 deb-src http://mentors.debian.net/debian unstable main contrib
non-free
But apt says it can't find binary packages at mentors.debian.net.
Infact, the repository at mentors.debian.net contains only a "source"
directory, not a binary one. So I removed the first line, and went on
compiling from source.
I run:
apt-get build-dep python-matplotlib
apt-get source --compile python-matplotlib
The compile command termed with exit status 1 and the process failed.
Here the complete output:
apt-get source --compile python-matplotlib
Lettura della lista dei pacchetti in corso... Fatto
Generazione dell'albero delle dipendenze in corso... Fatto
È necessario prendere 1646kB di sorgenti
Get:1 http://mentors.debian.net unstable/main python-matplotlib 0.61.0-1
(dsc) [761B]
Get:2 http://mentors.debian.net unstable/main python-matplotlib 0.61.0-1
(tar) [1641kB]
Get:3 http://mentors.debian.net unstable/main python-matplotlib 0.61.0-1
(diff) [4066B]
Scaricato 3B in 0s (4B/s)
Si è saltata l'estrazione del sorgente già estratto in
python-matplotlib-0.61.0
dpkg-buildpackage: source package is python-matplotlib
dpkg-buildpackage: source version is 0.61.0-1
dpkg-buildpackage: source changed by Vittorio Palmisano <re...@em...>
dpkg-buildpackage: host architecture i386
 debian/rules clean
dh_testdir
dh_testroot
rm -f *-stamp
rm -rf doc build setupext.pyc
dh_clean
 debian/rules build
make: Nothing to be done for `build'.
 debian/rules binary
dh_testdir
dh_testroot
dh_clean -k
dh_testdir
python ./setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.3
creating build/lib.linux-i686-2.3/matplotlib
copying matplotlib/patches.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/numerix.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/colors.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/transforms.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/finance.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/dates.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/cm.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/windowing.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/pyparsing.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/collections.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/na_imports.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/legend.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/text.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/afm.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/mlab.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/matlab.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/figure.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/table.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/nc_imports.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/font_manager.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/image.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/backend_bases.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/cbook.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/_matlab_helpers.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/_mathtext_data.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/mathtext.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/ticker.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/axes.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/axis.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/__init__.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/artist.py -> build/lib.linux-i686-2.3/matplotlib
copying matplotlib/lines.py -> build/lib.linux-i686-2.3/matplotlib
creating build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_template.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_agg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_gtk.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_wxagg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_svg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_tkagg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_gtkagg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/__init__.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_gd.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_paint.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_ps.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/backend_wx.py ->
build/lib.linux-i686-2.3/matplotlib/backends
copying matplotlib/backends/tkagg.py ->
build/lib.linux-i686-2.3/matplotlib/backends
running build_ext
building 'matplotlib._transforms' extension
creating build/temp.linux-i686-2.3
creating build/temp.linux-i686-2.3/src
creating build/temp.linux-i686-2.3/CXX
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -Isrc -I. -I/usr/include/python2.3 -c
CXX/cxx_extensions.cxx -o build/temp.linux-i686-2.3/CXX/cxx_extensions.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
./CXX/Objects.hxx: In constructor
'Py::MapBase<T>::const_iterator::const_iterator(const Py::MapBase<T>*,
Py::List, Py::SeqBase<Py::Object>::iterator)':
./CXX/Objects.hxx:2271: error: 's' was not declared in this scope
./CXX/Extensions.hxx: In constructor
'Py::PythonExtension<T>::PythonExtension() [with T =
Py::ExtensionModuleBasePtr]':
CXX/cxx_extensions.cxx:91: instantiated from here
./CXX/Extensions.hxx:472: warning: right-hand operand of comma has no effect
error: command 'gcc' failed with exit status 1
make: *** [build-stamp] Error 1
Comando di costruzione 'cd python-matplotlib-0.61.0 && dpkg-buildpackage
-b -uc' fallito.
W: Impossibile controllare la lista dei pacchetti sorgente
http://www.steve.org.uk ./ Packages
(/var/lib/apt/lists/www.steve.org.uk_apt_._Packages) - stat (2 No such
file or directory)
W: Impossibile controllare la lista dei pacchetti sorgente
http://people.debian.org ./ Packages
(/var/lib/apt/lists/people.debian.org_%7ejsogo_beagle_._Packages) - stat
(2 No such file or directory)
W: È consigliabile eseguire apt-get update per correggere questi problemi
E: Processo figlio fallito
From: Fernando P. <Fer...@co...> - 2005年09月15日 16:20:40
Humufr wrote:
> Hi,
> 
> I remark that matshow are not working with the subplot tool. It's logic 
> because this tools change the aspect of the graph but I remark that you 
> can add the colorbar and that change the aspect too. The problem I have 
> is to have the scale number on the colorbar visible. They are too long 
> on the right and it's diffiult to read them, so I try to use the tool 
> and I nothing move.
> 
> Like I told it's probably normal but in this case the colorbar is not 
> consistent with this.
Yes, unfortunately matshow doesn't know about colorbars. It would be a very 
nice enhancement to have, so one could get a colorbar and still get the right 
aspect ratio. But right now I'm working on other things, so that patch won't 
come from me. Feel free to contribute it.
Cheers,
f
From: Le Z. <zha...@gm...> - 2005年09月15日 15:57:41
Hello,
 I just tried the matplotlib-0.83.2 and found a problem in
hist(normed=3D1). Sometimes the *normalized* y values can be greater
than 1.0. I looked into the source code and find the code does not
perform the supposed *normalization*.
 =20
 Here's the code that shows the problem on a very unbalanced data:
 data =3D [3]*1000=20
 data.append(4)
 n, bins, patches =3D hist(data, 30, normed=3D1)
 print n
I got something like:
[ 29.97002997, 0. , 0. , 0. , 0. , 0. =
 ,
 0. , 0. , 0. , 0. , 0. ,
 0. , 0. , 0. , 0. , 0. ,
 0. , 0. , 0. , 0. , 0. ,
 0. , 0. , 0. , 0. , 0. ,
 0. , 0. , 0. , 0.02997003,]
the first column has a value much higher than 1.0, it's not a
probability distribution I believe.
Zhang Le
From: Humufr <hu...@ya...> - 2005年09月15日 15:17:29
 Hi,
I remark that matshow are not working with the subplot tool. It's logic 
because this tools change the aspect of the graph but I remark that you 
can add the colorbar and that change the aspect too. The problem I have 
is to have the scale number on the colorbar visible. They are too long 
on the right and it's diffiult to read them, so I try to use the tool 
and I nothing move.
Like I told it's probably normal but in this case the colorbar is not 
consistent with this.
Thanks,
N.
From: Humufr <hu...@ya...> - 2005年09月15日 14:59:48
This is a referenced bug/support:
http://sourceforge.net/tracker/index.php?func=detail&aid=1204314&group_id=80706&atid=560721
the only way to avoid this problem is to cut your data yourself not to 
let matplotlib does it for you.
N.
Malte Marquarding wrote:
>I don't know if that has been reported yet, but the size of postscript output 
>doesn't change when "less" points are plotted.
>
>x = range(8000)
>y = [rand() for i in x]
>plot(x,y)
>savefig("t.eps")
>xlim(0,1000)
>savefig("t2.eps")
>
>produces rougly the same size eps file.
>It seems that the PS backend draws outside the bounding box and then clips it.
>
>Is there any solution/workaround for this? If you submit ps files to 
>publishers they often restrict the size of the files.
>
>PS 
>I am using mpl 0.82
>
From: Malte M. <Mal...@cs...> - 2005年09月15日 07:14:56
I don't know if that has been reported yet, but the size of postscript output 
doesn't change when "less" points are plotted.
x = range(8000)
y = [rand() for i in x]
plot(x,y)
savefig("t.eps")
xlim(0,1000)
savefig("t2.eps")
produces rougly the same size eps file.
It seems that the PS backend draws outside the bounding box and then clips it.
Is there any solution/workaround for this? If you submit ps files to 
publishers they often restrict the size of the files.
PS 
I am using mpl 0.82
From: <sk...@po...> - 2005年09月14日 22:54:53
 John> I'm not ready to give up just yet; I hate to leave pesky bugs
 John> unsquashed. Did you get a chance to try the PS and Agg tests I
 John> suggested above? 
Nope, I forgot about them. Thanks for the reminder.
 >> python myscript.py -dGTKAgg
Core dump, as before.
 >> python myscript.py -dGTK
Works with some complainst about fonts: 
 ** (myscript.py:8466): WARNING **: Couldn't load font "Bitstream Vera
 Sans, normal, 13" falling back to "Sans 13"
 >> python myscript.py -dPS
Works.
 >> python myscript.py -dAgg
Works.
 John> Also, if you get a chance to make the debug build I suggested
 John> earlier with VERBOSE=True and could send the output my way, that
 John> would help.
I'll try to remember to give that a try tomorrow.
Thanks for your persistence...
Skip
From: John H. <jdh...@ac...> - 2005年09月14日 22:38:10
>>>>> "skip" == skip <sk...@po...> writes:
 Fernando> So unless you end up needing to embed mpl into GTK apps
 Fernando> ...
 skip> That was precisely my thought... Even if we only get it
 skip> working with Tk, we'll at least have a much better tool than
 skip> GNUplot.
I'm not ready to give up just yet; I hate to leave pesky bugs
unsquashed. Did you get a chance to try the PS and Agg tests I
suggested above? I'm assuming since the TkAgg backend worked these
will too. It would help narrow the bug to know which of these
commands work on the canonical script
from pylab import plot, savefig, show
plot([1,2,3])
savefig('test')
show()
 > python myscript.py -dGTKAgg
 > python myscript.py -dGTK
 > python myscript.py -dPS
 > python myscript.py -dAgg
In particular, it would be nice to know if GTK and GTKAgg are both
broken, or just GTKAgg.
Also, if you get a chance to make the debug build I suggested earlier
with VERBOSE=True and could send the output my way, that would help.
Thanks,
JDH
From: <sk...@po...> - 2005年09月14日 22:25:30
 Fernando> So unless you end up needing to embed mpl into GTK apps ...
That was precisely my thought... Even if we only get it working with Tk,
we'll at least have a much better tool than GNUplot.
Skip
From: Fernando P. <Fer...@co...> - 2005年09月14日 21:10:09
sk...@po... wrote:
> >> Any simpler suggestions?
> 
> Fernando> Can you use TkAgg as your backend (set it in
> Fernando> ~/.matplotlib/matplotlibrc)? 
> 
> Thanks for the suggestion. To be honest, I'd never even considered Tk since
> we're a Gtk shop. That worked in both interactive and batch (well, at least
> the simple first example from the tutorial worked). That narrows my problem
> space down to Gtk and PyGtk. I suspect I could have guessed the problem was
> in the Gtk space without performing any tests though...
Good. Most likely, everything will work. I use TkAgg for all my stuff, and 
it's fine. Even if you get GTK to build, it won't mean you're out of the 
woods. John and I have been trying, unsuccessfully, to track down a very 
bizarre GTK-only crash. Since ipython plays thread tricks to make an 
interactive console coexist happily with the gtk event mainloop, it's bound to 
be a more brittle setup than plain old Tk.
So unless you end up needing to embed mpl into GTK apps or have a burning 
desire to spend the weekend in the company of Electric Fence and gdb, Tk might 
just be enough.
Cheers,
f
From: <sk...@po...> - 2005年09月14日 21:02:36
 >> Any simpler suggestions?
 Fernando> Can you use TkAgg as your backend (set it in
 Fernando> ~/.matplotlib/matplotlibrc)? 
Thanks for the suggestion. To be honest, I'd never even considered Tk since
we're a Gtk shop. That worked in both interactive and batch (well, at least
the simple first example from the tutorial worked). That narrows my problem
space down to Gtk and PyGtk. I suspect I could have guessed the problem was
in the Gtk space without performing any tests though...
 Fernando> Even if you need GTK/WX, you may want to test with Tk just to
 Fernando> see what happens, before pulling the heavy artillery out.
Granted.
Skip
From: John H. <jdh...@ac...> - 2005年09月14日 18:03:26
>>>>> "skip" == skip <sk...@po...> writes:
One more comment. I doubt this is the src of your woes, but don't do
this:
 import pygtk
 pygtk.require('2.6')
 import gtk
 from pylab import *
 plot([1,2,3,4])
 show()
 gtk.main()
You can either use matplotlib in GUI / API mode (eg
examples/embedding_in_gtk*.py) or in pylab mode, which hides the GUI.
"show", for example, starts the mainloop, so you don't want to call
show and gtk.main.
FYI, it is a common complaint that the OO interface is not as well
documented as the pylab interface. The classdocs are pretty good
though, and there are plenty of examples in the examples dir. Robert
Leftwich also provides this tutorial
 http://matplotlib.sf.net/leftwich_tut.txt
Assuming of course you can stop the thing from segfaulting :-(
From: John H. <jdh...@ac...> - 2005年09月14日 17:56:19
>>>>> "skip" == skip <sk...@po...> writes:
 skip> It would appear something else is going on here other than
 skip> straightforward issues of whether or not I'm running
 skip> interactively. Unfortunately, the wild differences between
 skip> the two gdb backtraces suggest that I'm going to have to
 skip> drag out Electric Fence or some other malloc debugger to
 skip> figure out what's wrong (oh joy, oh happy thought...), which
 skip> I don't have time for at the moment.
 skip> Any simpler suggestions?
Arggg. Sorry you are having so much trouble.
Two suggestions: try running different backends with a minimal script
 from pylab import plot, savefig
 plot([1,2,3])
 savefig('test')
run from the command line with
 > python myscript.py -dPS --verbose-helpful
 > python myscript.py -dAgg --verbose-helpful
and see if you get segfaults on both or either of the postscript and
agg pure image backends (taking gtk and attendant complexities out of
the loop). The --verbose-helpful information will be useful to post.
Also run with --verbose-debug which produces lots of extra
information like which fonts are being loaded etc. I have seen some
fonts which have crashed the mpl extension code, and I've tried to fix
these bugs when I find them.
If none of this is enlightening, do 
 > sudo rm -rf build /your/path/to/site-packages/matplotlib
and toggle the VERBOSE flag to True in setup.py and rebuild/reinstall.
This will cause the extension code to spew lots of extra debug
information, and usually helps narrow the locus of the bad code.
Let me know...
JDH
From: Fernando P. <Fer...@co...> - 2005年09月14日 17:53:15
sk...@po... wrote:
[ pain and suffering with gdb and EE menacingly lurking on the horizon ]
> Any simpler suggestions?
Can you use TkAgg as your backend (set it in ~/.matplotlib/matplotlibrc)? 
Personally I don't use any of the threaded backends, but just plain old Tk. 
While not as flashy as the others, it has the advantage of being very stable, 
allowing Ctrl-C to interrupt long-running computations, and letting me use 
other Tk-based apps I need.
Even if you need GTK/WX, you may want to test with Tk just to see what 
happens, before pulling the heavy artillery out.
Further, note that in ipython -pylab, you can type:
run myscript.py
and it will run your script (it's basically a wrapper around execfile() with 
fancy namespace hacks and control of matplotlib's rendering loop).
Let us know how that goes, I'll try to help as well.
Cheers,
f
From: <sk...@po...> - 2005年09月14日 17:46:08
 John> The problem here is that "show" starts the GUI mainloop when using
 John> a GUI backend (GTKAgg is the default)....
 John> The recommended approach for using the GTK/WX/Qt backends
 John> interactively from the shell is to use the ipython shell.
 John> Eg, you can do
 >> ipython -pylab
 John> Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
 John> Type "copyright", "credits" or "license" for more information.
 John> In [1]: hist(randn(10000), 100)
 John> and your plot should appear automagically.
Thanks for the continued help. I installed ipython 0.6.15 and the default
matplotlibrc. Ipython needed one tweak to the matplotlib import (it was
looking for matplotlib.matlab and matplotlib.pylab, but not
matplotlib.mlab). Your interactive hist(...) example also segfaults.
I tried a simple script:
 import pygtk
 pygtk.require('2.6')
 import gtk
 from pylab import *
 plot([1,2,3,4])
 show()
 gtk.main()
run in batch. That also segfaults. The gdb backtrace was massive. I gave
up looking after 600+ frames had been displayed and resorted to pystack
instead:
 (gdb) pystack
 /opt/lang/python/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py (611): _init_toolbar2_4
 /opt/lang/python/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py (567): _init_toolbar
 /opt/lang/python/lib/python2.3/site-packages/matplotlib/backend_bases.py (971): __init__
 /opt/lang/python/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py (507): __init__
 Previous frame inner to this frame (corrupt stack?)
Reducing my simple script to just
 from pylab import *
 plot([1,2,3,4])
 show()
yields another segfault, with this minimalist backtrace:
 (gdb) bt
 #0 0xd0cf29fc in strlen () from /lib/libc.so.1
 #1 0xd0d47e3e in _ndoprnt () from /lib/libc.so.1
 #2 0xd0d4af3b in vsnprintf () from /lib/libc.so.1
 #3 0xcf8e9cda in g_printf_string_upper_bound () from /usr/lib/libglib-2.0.so.0
It would appear something else is going on here other than straightforward
issues of whether or not I'm running interactively. Unfortunately, the wild
differences between the two gdb backtraces suggest that I'm going to have to
drag out Electric Fence or some other malloc debugger to figure out what's
wrong (oh joy, oh happy thought...), which I don't have time for at the
moment.
Any simpler suggestions?
Skip
From: John H. <jdh...@ac...> - 2005年09月14日 13:25:58
>>>>> "Martin" == Martin Richter <law...@gm...> writes:
 Martin> Hello everyone, Hello John,
 Martin> thank you very much for your example - it is really
 Martin> fantastic. This was exactly what I meant.
 Martin> When I was trying to rewrite your code to a
 Martin> 'fastplot()'-command (which would just be able to plot one
 Martin> point at a time) it worked quite well with the
 Martin> Circle()-command you used. But is there a possibility to
 Martin> write the 'fastplot' in a way so that it can be used like
 Martin> fastplot(x,y, marker='s', color='g',markersize = 3)?
This approach can work, but may not be as fast as possible since there
is more machinery in Line2D than you need (eg the sequence stuff, the
optional linestyle) and logically what you are doing is creating a
polygon. One option would be to create a polygon factory function or
class which parses a marker string and creates the Polygon instance
you want for your marker. You could lift the logic from Line2D, eg
 markerd = {
 . : _make_point,
 , : _make_pixel,
 o : _make_circle, 
 v : _make_triangle_down,
 ...snip
 }
where, for example _make_triangle_down is a stripped down version of
matplotlib.lines.Line2D._draw_triangle_down
 def _make_triangle_down(size):
 return ( (-size, size),
 (size, size),
 (0, -size))
you could then create the polygon as I did in my original example code
# this is just a sketch and not complete code, eg you will want to
# compute size appropriately as in the previous example
def polygon_factory(marker, **kwargs) 
 func = markerd[marker]
 verts = func(size)
 trans = identity_transform()
 trans.set_offset( (x, y), ax.transData)
 poly = Polygon( verts, transform=trans, **kwargs )
 poly.set_clip_box(ax.bbox)
 return poly
You could then use this function like
poly = polygon_factory('s', facecolor='blue', linewidth=2)
If you wanted full parsing of matplotlib format strings (eg 'go' for
green circle) which includes both color and marker, you can use
matplotlib.axes._process_plot_format or a variant of it.
 Martin> In the example given below the color is not recognized
 Martin> correctly. Do I use Line2D in a wrong way?
Line2D has both an a linestyle and a marker (eg you can pcreate a
single line instance which is 'ro--' (red dashed line with circle
markers). "color" and "linewidth" control the linestyle properties.
"markerfacecolor, ""markeredgecolor", and "markeredgewidth" control
the marker properties. Again, this illustrates why a Line2D object is
a bit too heavy for your needs. The polygon factory function would be
a useful addition to matplotlib.
 Martin> A second question aims on the running-behavior: It - well
 Martin> - stumbles a little bit. If you add a print i to the
 Martin> for-loop you can see that the counting is done very
 Martin> smoothly. But the plot isn't (at least at my computer -
 Martin> maybe this is already the answer).
As I've pointed out before (eg at the animation wiki
http://www.scipy.org/wikis/topical_software/Animations), the pylab
animation technique is for simple throw-away animations. To produce
nice animations, you need to use your GUI timer or idle function
handling. Eg, if I remove your ion, ioff calls and replace your
update functionality with
 def update(*args):
 i = update.cnt
 fastplot_points( x[i], y[i],marker='s',color='r')
 update.cnt +=1
 if update.cnt<1000: return True
 else: return False
 update.cnt = 0
 tend = time.time()
 print 'It took %4.2f s.'%(tend - tstart)
 import gobject
 gobject.idle_add(update)
 show()
The "jerky" update problem you describe goes away.
JDH
From: John H. <jdh...@ac...> - 2005年09月14日 12:44:27
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
 Jeff> DateLocator((max-min)/8.0)
 ...snip...
 Jeff> Does anyone know what might be the problem with the
 Jeff> datelocator() as I've done it?
If you look at the documentation for the DateLocator
 http://matplotlib.sourceforge.net/matplotlib.dates.html#DateLocator
you'll see that it takes a single argument in the init function which
is a timezone. You are passing it (min-max)/8.0 which in my guess
does not evaluate to a timezone unless you are deep into overload
magic <wink>
DateLocator is base class and you will need to instantiate one of the
derived classes (eg MonthLocator). What plot_date does is inspect the
date range and try to make an intelligent guess about which kind of
locator you need. I just factored this code into a reusable date
locator/formatter factory function which is in CVS
 Checking in lib/matplotlib/dates.py;
 /cvsroot/matplotlib/matplotlib/lib/matplotlib/dates.py,v <-- dates.py
 new revision: 1.12; previous revision: 1.11
I'll post it here in case you don't have access to CVS and just want
to plug it into your application
import math
from matplotlib.dates import YearLocator, MonthLocator, WeekdayLocator, \
 DayLocator, HourLocator, MinuteLocator, DateFormatter
def date_ticker_factory(span, tz=None, numticks=5):
 """
 Create a date locator with numticks (approx) and a date formatter
 for span in days. Return value is (locator, formatter)
 """
 
 if span==0: span = 1/24.
 minutes = span*24*60
 hours = span*24
 days = span
 weeks = span/7.
 months = span/31. # approx
 years = span/365.
 if years>numticks:
 locator = YearLocator(int(years/numticks), tz=tz) # define
 fmt = '%Y'
 elif months>numticks:
 locator = MonthLocator(tz=tz)
 fmt = '%b %Y'
 elif weeks>numticks:
 locator = WeekdayLocator(tz=tz)
 fmt = '%a, %b %d'
 elif days>numticks:
 locator = DayLocator(interval=int(math.ceil(days/numticks)), tz=tz)
 fmt = '%b %d'
 elif hours>numticks:
 locator = HourLocator(interval=int(math.ceil(hours/numticks)), tz=tz)
 fmt = '%H:%M\n%b %d'
 elif minutes>numticks:
 locator = MinuteLocator(interval=int(math.ceil(minutes/numticks)), tz=tz)
 fmt = '%H:%M:%S'
 else:
 locator = MinuteLocator(tz=tz)
 fmt = '%H:%M:%S'
 formatter = DateFormatter(fmt, tz=tz)
 return locator, formatter
locator, formatter = date_ticker_factory(2000, numticks=8)
print locator, formatter
From: John H. <jdh...@ac...> - 2005年09月14日 12:26:54
>>>>> "skip" == skip <sk...@po...> writes:
 Skip> >>> plot([1,2,3,4])
 Skip> [<matplotlib.lines.Line2D instance at 0x8790d6c>]
 Skip> >>> show()
 Skip> (process:3261): GLib-GObject-CRITICAL **: gtype.c:2253: 
 Skip> initialization assertion failed, use g_type_init() prior to 
 Skip> this function
 Skip> Segmentation Fault (core dumped)
The problem here is that "show" starts the GUI mainloop when using a
GUI backend (GTKAgg is the default). To use the GTK, WX, or Qt
backends from a shell, you need to use a shell that starts the GUI
mainloop in a separate thread (Tkinter is special in this regard, in
that it can be use from the shell with no special threading calls, so
if you need to use the standard python shell for interactive work, you
should use the TkAgg backend). Also, you should not be using "show"
when working interactively from the shell. This is discussed in more
detail at
 http://matplotlib.sourceforge.net/interactive.html
and 
 http://matplotlib.sourceforge.net/faq.html#SHOW
The recommended approach for using the GTK/WX/Qt backends
interactively from the shell is to use the ipython shell. ipython is
an easy install (pure python) and in addition to lots of nice
interactive features, has matplotlib support. Specifically, in the
pylab mode
 > ipython -pylab
it will read your matplotlibrc file, detect your backend, issue the
proper threading and timer/idle calls as needed for GTK, WX, Qt or Tk,
import the pylab namespace and wash your dishes
 http://ipython.scipy.org
Eg, you can do
> ipython -pylab
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
Type "copyright", "credits" or "license" for more information.
In [1]: hist(randn(10000), 100)
and your plot should appear automagically.
If for some reason ipython is not an option for you, and you need to
use a GTK backend from the shell, there is some template code in the
matplotlib examples directory showing how to write a custom shell with
the proper gtk threading calls.
JDH
From: <sk...@po...> - 2005年09月13日 21:08:28
 skip> parse error before `typename' error: command 'gcc' failed
 skip> with exit status 1
 John> Hey Skip, this looks like a known pygtk bug -- fortunately th=
ere's
 John> a simple fix
 John> http://matplotlib.sourceforge.net/faq.html#PYGTK24
Thanks John. The fact that it was a PyGTK bug pointed me in the direct=
ion
of switching from gtk 2.4 to gtk 2.6. Problem solved.
On to my next problem ... :-)
After only a small further amount of wailing and gnashing of teeth I go=
t
matplotlib to build and install (just some -I, -L & -R flags for the
build_ext command). Then I decided to tackle the tutorial. Example 1:=
 % python
 Python 2.3.4 (#12, Jul 2 2004, 09:48:10)
 [GCC 3.3.2] on sunos5
 Type "help", "copyright", "credits" or "license" for more informati=
on.
 >>> import pygtk
 >>> pygtk.require('2.6')
 >>> from pylab import *
 >>> plot([1,2,3,4])
 [<matplotlib.lines.Line2D instance at 0x8790d6c>]
 >>> show()
 (process:3261): GLib-GObject-CRITICAL **: gtype.c:2253: initializat=
ion assertion failed, use g_type_init() prior to this function
 Segmentation Fault (core dumped)
Unfortunately, I'm not sure what further information to give you to hel=
p
tracking down the location. I have to run for the train, but will at l=
east
try running under gdb ma=F1ana. In the meantime, any suggestions about=
potential causes would be gracefully appreciated.
Skip
From: Sascha <sas...@gm...> - 2005年09月13日 20:31:30
Hello Yves,
> However, integrating matplotlib functionnalities
> through an External Method is a pain to maintain : any change to your 
> function
> means delete/recreate an External Method object in Zope. Not very 
> sustainable.
Just a quick comment: I also use External Methods for creating Matplotlib 
charts but deleting/recreating is not necessary upon changes. Maybe you had 
to do this because you were not running Zope in debug mode? Haven't tried 
this with debug off though.
Best regards,
Sascha 
From: Yves M. <ym...@gr...> - 2005年09月13日 19:42:13
David Dougall writes:
> I am a new Zope user and am trying to use matplotlib in a Zope application and 
> need some guidance on how to do so. 
> From a previous post in February 2005 (2-17-05), someone had a similar
problem. > From the archives, I'm not quite sure it was solved.
> This is the only related answer I found.
>From: Yves Moisan <ymoisan@gr...>
I'm sorry I took so long to chime in, but I have to use gmane's web interface
and for some reason I couldn't get to see your message. I still can't, but at
least I can see one of Sascha's replies that I can do a follow up on.
My first go at integrating matplotlib into Zope was via an external method and I
sent you some code about that. However, integrating matplotlib functionnalities
through an External Method is a pain to maintain : any change to your function
means delete/recreate an External Method object in Zope. Not very sustainable.
A better way is to use Archetypes (is you are a Plone or at least a CMF user). 
See thread at : http://plone.org/documentation/how-to/add-charts
Saving a PNG to a file and then updating an Archetypes ImageField (as described
in the above link) works well. I've worked out a way to use a tempFile and I
guess it probably works without tempFile also. So long as you save it to an
Archetypes field. 
If you try to pump the resulting image out e.g. in a tal statement, that is
without using an intermediate save step into an Archetypes field, then it won't
work (see thread above). If you happen to find a way of doing this, please let
me know. Using matplotlib in CMF/Plone for me currently implies having to add
an ImageField just to hold what usually amounts to be a temporary image. There
shouldn't be a need to store it in a content object.
Keep us posted on your trials!
Yves Moisan
From: Jeff P. <jef...@se...> - 2005年09月13日 16:44:48
Hello, I'm using python 2.4 and matplotlib 0.83 with WXAgg. I'm having
trouble with plot dates and the datelocator. I want to show only 5 dates
tick labels because anymore than this then the labels get crunched
together. I can get this to work with the multiplelocator but not the
datelocator. I copied the function I call to manage all my plot
attributes below. I input the canvas figure, two axes instances (axesA,
and axesD) and a class called myAxes which holds attributes like label
size and font and colors and such. I am trying to do something like this
(this is part of the code copied below):
 elif myAxes.majorFormatName == 'Dates':
 min, max = Numeric.array(axesA.get_xlim())
 xFormat = DateFormatter('%m/%d/%y')
 xmajorLocator = DateLocator((max-min)/8.0)
 # set major x tick format
 axesD.xaxis.set_major_formatter(xFormat)
 # set major x tick format
 axesA.xaxis.set_major_formatter(xFormat)
 
 if myAxes.autoScale == False:
 # set major locator
 axesD.xaxis.set_major_locator(xmajorLocator)
 # set major locator
 axesA.xaxis.set_major_locator(xmajorLocator)
Notice I have to be aware of whether or not autoScale is being used. I
am not sure about this either. Can I set the locator and use auoscale? I
was having some errors occur when I tried to do this. The way it shows
above seems to solve that problem.
Does anyone know what might be the problem with the datelocator() as
I've done it? 
Thanks!
Jeff
# redraw figure attributes
def Plot_Figure_Attributes(figure, myAxes, axesD, axesA):
 
 # set where to tick
 axesA.yaxis.tick_left()
 axesD.yaxis.tick_left()
 axesA.xaxis.tick_bottom()
 axesD.xaxis.tick_bottom()
 
 # turn axes on or off
 if myAxes.ShowAxesFrame == True:
 axesD.set_frame_on(True)
 axesA.set_frame_on(True)
 else:
 axesD.set_frame_on(False)
 axesA.set_frame_on(False)
 
 # set range limits
 if myAxes.autoScale == False:
 axesA.set_xlim((myAxes.xRangeMin, myAxes.xRangeMax))
 axesD.set_xlim((myAxes.xRangeMin, myAxes.xRangeMax))
 axesA.set_ylim((myAxes.yRangeMinA, myAxes.yRangeMaxA))
 axesD.set_ylim((myAxes.yRangeMinD, myAxes.yRangeMaxD))
 else:
 axesA.autoscale_view()
 axesD.set_xlim(axesA.get_xlim())
 
 # set figure background color
 axesA.set_axis_bgcolor(myAxes.edgeColor)
 axesD.set_axis_bgcolor(myAxes.edgeColor)
 # set figure face color
 figure.set_facecolor(myAxes.figureColor)
 
 # set legend
 if myAxes.legendShow == True:
 #get all instances of lines created by Plot()
 lines = axesA.get_lines()
 
	 #create the legend
 figure.legend(lines,
 myAxes.labels,
 'upper right')
 # set grid
 if myAxes.gridShow == True:
 axesD.grid(True)
 axesA.grid(True)
 
 if myAxes.yLabelShow == True:
 # set figure y label 
 axesD.set_ylabel(myAxes.yLabelD, color=myAxes.yLabelColor,
size=myAxes.yLabelSize, rotation=myAxes.yLabelRot)
 # set figure y label 
 axesA.set_ylabel(myAxes.yLabelA, color=myAxes.yLabelColor,
size=myAxes.yLabelSize, rotation=myAxes.yLabelRot)
 
 if myAxes.xLabelShow == True:
 # set figure x label
 axesD.set_xlabel(myAxes.xLabelD, color=myAxes.xLabelColor,
size=myAxes.xLabelSize, rotation=myAxes.xLabelRot)
 
 if myAxes.titleShow == True:
 # set figure title
 axesA.set_title(myAxes.title, color = myAxes.titleColor, size =
myAxes.titleSize)
 (min, max) = axesA.get_ylim()
 # define major y tick locator
 ymajorLocator = MultipleLocator((max-min)/myAxes.yMajorTickLoc)
 # define minor y tick locator
 yminorLocator = MultipleLocator((max-min)/myAxes.yMinorTickLoc)
 # define major y tick format
 yFormat = FormatStrFormatter(myAxes.yLabelPrecision)
 
 # define minor x formats and locators
 if myAxes.majorFormatName == 'Multiples':
 (min, max) = axesA.get_xlim()
 if (max-min)/myAxes.xMinorTickLoc < 1:
 xmajorLocator = 1
 else:
 xmajorLocator = (max-min)/5.0
 xmajorLocator = MultipleLocator(xmajorLocator) 
 xFormat = FormatStrFormatter('%d')
 elif myAxes.majorFormatName == 'Seconds': 
 xmajorLocator = SecondLocator()
 xFormat = DateFormatter('%S')
 elif myAxes.majorFormatName == 'Dates':
 min, max = Numeric.array(axesA.get_xlim())
 xFormat = DateFormatter('%m/%d/%y')
 xmajorLocator = DateLocator((max-min)/8.0)
 elif myAxes.majorFormatName == 'Minutes':
 xmajorLocator = MinuteLocator()
 xFormat = DateFormatter('%M')
 elif myAxes.majorFormatName == 'Hours':
 xmajorLocator = HourLocator()
 xFormat = DateFormatter('%H')
 elif myAxes.majorFormatName == 'Days':
 xmajorLocator = DayLocator()
 xFormat = DateFormatter('%m/%d/%y')
 elif myAxes.majorFormatName == 'Months':
 xmajorLocator = MonthLocator()
 xFormat = DateFormatter('%m/%d/%y')
 elif myAxes.majorFormatName == 'Years':
 xmajorLocator = YearLocator()
 xFormat = DateFormatter('%m/%d/%y')
 # set major x tick format
 axesD.xaxis.set_major_formatter(xFormat)
 # set major x tick format
 axesA.xaxis.set_major_formatter(xFormat)
 
 if myAxes.autoScale == False:
 # set major locator
 axesD.xaxis.set_major_locator(xmajorLocator)
 # set major locator
 axesA.xaxis.set_major_locator(xmajorLocator)
 # set x and y tick labels attributes 
 setAttr(axesA.get_yticklabels(),
fontsize=myAxes.yTickLabelSize,visible=True)
 setAttr(axesD.get_yticklabels(),
fontsize=myAxes.yTickLabelSize,visible=True)
 setAttr(axesA.get_xticklabels(),
fontsize=myAxes.xTickLabelSize,visible=True)
 setAttr(axesD.get_xticklabels(),
fontsize=myAxes.xTickLabelSize,visible=True)
 
From: Martin R. <law...@gm...> - 2005年09月13日 14:24:16
Hello everyone,
Hello John,
thank you very much for your example - it is really fantastic. This was
exactly what I meant.
When I was trying to rewrite your code to a 'fastplot()'-command (which
would just be able to plot one point at a time) it worked quite well with
the Circle()-command you used. But is there a possibility to write the
'fastplot' in a way so that it can be used like
 fastplot(x,y, marker='s', color='g',markersize = 3)?
In the example given below the color is not recognized correctly. Do I use
Line2D in a wrong way?
A second question aims on the running-behavior: It - well - stumbles a
little bit. If you add a
 print i
to the for-loop you can see that the counting is done very smoothly. But the
plot isn't (at least at my computer - maybe this is already the answer).
Once again: Thanks!
Bye,
Martin
#-----------------------------------------------------------------------
"""A try to enable a fastplot() command"""
def fastplot_points(*args, **kwargs):
 """This program tries to enable a routine 'fastplot' 
 based on JDH's code doing blit only in a small region 
 around the new object.
 Notice: args have to be (x, y) and not ([x], [y]) like for plot().
 x,y are floats - not vectors!
 """
 from matplotlib.lines import Line2D
 from matplotlib.transforms import identity_transform, lbwh_to_bbox
 ax = gca()
 trans = identity_transform()
 trans.set_offset( args, ax.transData)
 line = Line2D([0],[0], transform=trans, **kwargs)
 line.set_clip_box(ax.bbox)
 ax.add_line(line)
 l,b,w,h = line.get_window_extent(ax.get_renderer_cache()).get_bounds()
 pad = 3
 bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)
 ax.draw_artist(line)
 ax.figure.canvas.blit(bbox)
#-----------------------------------------------------------------------
from pylab import *
import time
n=1000
phi=2.0*pi*arange(n)/n
x=cos(phi)
y=sin(phi)
ion()
figure(1)
subplot(111, autoscale_on=False)
tstart = time.time()
title('point by point with blitting')
print " fastplot every point seperately ... "
axis([-1,1,-1,1])
axis('scaled')
draw() # necessary to get renderer
for i in xrange(n): # plot all data step by step
 fastplot_points( x[i], y[i],marker='s',color='r')
tend = time.time()
print 'It took %4.2f s.'%(tend - tstart)
close(1)
ioff()
-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
From: John H. <jdh...@ac...> - 2005年09月13日 11:52:35
>>>>> "skip" == skip <sk...@po...> writes:
 skip> file included from src/_gtkagg.cpp:10:
 skip> /opt/app/gnome-2.4/include/pygtk-2.0/pygobject.h:140: error:
 skip> parse error before `typename'
 skip> /opt/app/gnome-2.4/include/pygtk-2.0/pygobject.h:147: error:
 skip> parse error before `typename' error: command 'gcc' failed
 skip> with exit status 1
 ....
 skip> Has anyone else encountered this problem? If so, do you
 skip> have a workaround?
Hey Skip, this looks like a known pygtk bug -- fortunately there's a
simple fix
 http://matplotlib.sourceforge.net/faq.html#PYGTK24
If you encounter any solaris specific compile issues that require
workarounds, it might be a good idea to make a few notes
and post them here or on the wiki because a number of people have
reported problems in the past, though I also know a number have
succeeded.
Good luck,
JDH
From: Fernando P. <Fer...@co...> - 2005年09月12日 21:06:07
Humufr wrote:
> My fault, I didn't read with enougth attention the help. I have another 
> question so:
> 
> For a same matrice with imshow and matshow. I obtain the two images include.
> They are very different for the axes and the aspect.
That's precisely why matshow was written, to address the aspect/size problems 
of using imshow when a 'matrix display' was desired.
If you want something which is similar to matshow but tuned for your own 
purposes, I suggest you just copy the matshow source and start modifying it. 
It's a short function, so you shouldn't have problems.
Cheers,
f
3 messages has been excluded from this view by a project administrator.

Showing results of 352

<< < 1 .. 5 6 7 8 9 .. 15 > >> (Page 7 of 15)
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 によって変換されたページ (->オリジナル) /