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





Showing results of 27

1 2 > >> (Page 1 of 2)
From: <qu...@gm...> - 2009年11月12日 23:47:04
Good evening.
I would like to be able to dock some figures into one window
and be able to look at them by tabs or something similar.
Is something like that already implemented or does someone know
of a widget that can do that?
If not ... do you have suggestions of how i could do that?
Thanks for your help
q
-- 
The king who needs to remind his people of his rank, is no king.
To gain that which is worth having, it may be necessary to lose everything else.
From: Ryan N. <ne...@em...> - 2009年11月12日 23:33:31
Eric,
Here's a pcolor plot of the same data:
contour_plot = pyplot.pcolor(x_grid,y_grid,z_grid_masked)
http://imgur.com/iL4k7.png
For contourf I'm using:
contour_plot =
pyplot.contourf(x_grid,y_grid,z_grid_masked,contour_levels,origin='upper',\
 extent=extent,cmap=pyplot.cm.jet)
... where there are 256 evenly spaced contour_levels.
Note that we have many more points on the Y (depth) axis than the X (time).
Each Y axis column originally had about 50 irregularly spaced data points,
but I used scipy.interpolate.interp1d to make my grid even. I then increased
the density substantially to smooth the data.
I don't know if this matters.
I'm not familiar with pcolorfast & pcolormesh, but I'll look in to that
tomorrow.
Many Thanks,
-Ryan
On Thu, Nov 12, 2009 at 1:11 PM, Eric Firing <ef...@ha...> wrote:
> Ryan Neve wrote:
>
>> Thank you for the suggestion, but I couldn't see a difference with
>> "antialiased" either True or False. The lines between contour levels remain.
>> I tried a different colormap (spectral) but it had the same effect. I
>> tried more color levels (256) but the effect got worse.
>>
>> I can't find any example pictures online of matplotlib's contourf()
>> producing a "smooth" plot, I know matlab's does it:
>>
>> http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
>>
>
> That looks to me like a pcolor plot, not a contourf plot, regardless of
> what the file name says. And, maybe it is my eyes, but it looks to me like
> there are artifacts in the colorbar. In any case, if you are plotting a
> very densely sampled data set, you may want to use the Axes.pcolorfast
> method or the pcolormesh function or method instead of contourf.
> Contouring, filled or not, is suitable for data in which you want to bring
> out a moderate number of regions, not for data with highly complex structure
> and texture, or if you want essentially a smooth color progression.
>
> Eric
>
>
>>
>> -Ryan
>>
>>
>> On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha... <mailto:
>> ef...@ha...>> wrote:
>>
>> Ryan Neve wrote:
>>
>> Hello,
>> In my filled contour plot: http://imgur.com/vXoCL.png
>> There are faint lines between the contour levels. I think they
>> are yellow since they disappear in the yellow parts of the graph
>> and are most obvious in the red areas. Is there any way to get
>> rid of these lines? The number of contour levels is arbitrary,
>> and I don't need them emphasized with a moire pattern.
>>
>>
From: Geoffrey E. <ge...@us...> - 2009年11月12日 23:32:45
On Nov 12, 2009, at 2:01 PM, Christopher Barker wrote:
> Geoffrey Ely wrote:
>> Hi, What is the best way to rasterize a figure into a numpy array for
>> further image processing?
>
> untested, but I suspect:
>> image = 
>> numpy.frombuffer( fig.canvas.renderer.buffer_rgba).reshape( shape )
Thanks for the help. With that I get:
AttributeError: 'function' object has no attribute '__buffer__'
I found a cleaner way to get the shape, so this is getting better:
shape = fig.canvas.get_width_height()[::-1] + (3,)
image = numpy.fromstring( fig.canvas.renderer.tostring_rgb(), 
'u1' ).reshape( shape )
-Geoff
From: Robert K. <rob...@gm...> - 2009年11月12日 23:11:06
On 2009年11月12日 16:44 PM, Andrew Straw wrote:
> Robert Kern wrote:
>> On 2009年11月12日 12:05 PM, Andrew Straw wrote:
>>
>>> Celil Rufat wrote:
>>>
>>>> I just installed matplotlib on Snow Leopard 10.6 with the Qt4 backend
>>>> (via macports). However, when I try one of the Qt4 examles:
>>>>
>>>> python
>>>> /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py
>>>>
>>>>
>>>> IOError: [Errno 4] Interrupted system call
>>>>
>>>> Any ideas on what could be causing this?
>>>>
>>> Out of curiosity, does anyone know where the signal interrupting the
>>> system call is originating? Is this a standard communication mechanism
>>> within Qt4? (I have never used Qt4.) I'm interested in knowing about OSS
>>> that use signals as a means of across-thread or across-process
>>> communication.
>>>
>>
>> This problem arises when signal handlers are installed, not necessarily when a
>> signal itself is sent (dtrace doesn't detect any).
> Hmm, but a system call isn't going to get interrupted and return EINTR
> by any means other than a signal. So the OP must have had a signal
> interrupting the call and it must have come from somewhere. Or... am I
> wrong?
Well, SIGCHLD is sent by the OS when the child process completes. There is a 
SIGCHLD handler registered in ./src/corelib/io/qprocess_unix.cpp . I'm not sure 
how to avoid it, though.
I think I can verify this now:
$ really dtrace -n 'proc:::signal-handle /pid==$target/ { ustack(); 
printf("Signal: %d\n", arg0);}' -c "python application.py"
dtrace: description 'proc:::signal-handle ' matched 2 probes
Traceback (most recent call last):
 File "application.py", line 247, in <module>
 commands.getstatusoutput( "otool -L %s | grep libedit" % _rl.__file__ )
 File 
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/commands.py", 
line 54, in getstatusoutput
 text = pipe.read()
IOError: [Errno 4] Interrupted system call
dtrace: pid 47973 has exited
CPU ID FUNCTION:NAME
 1 18577 sendsig:signal-handle
 libSystem.B.dylib`read+0xa
 libSystem.B.dylib`__srefill+0x127
 libSystem.B.dylib`fread+0x9f
 0x1c2d9b
 0x23affa
 0x23bde1
 0x23c7fa
 0x23c907
 0x260d37
 0x2610e3
 0x26f855
 python`0x1f82
 python`0x1ea9
 0x2
Signal: 20
$ python -c "import signal;print signal.SIGCHLD"
20
So it is getting SIGCHLD. I think my previous probes weren't getting signals 
from the OS itself.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Andrew S. <str...@as...> - 2009年11月12日 22:45:33
Robert Kern wrote:
> On 2009年11月12日 12:05 PM, Andrew Straw wrote:
> 
>> Celil Rufat wrote:
>> 
>>> I just installed matplotlib on Snow Leopard 10.6 with the Qt4 backend
>>> (via macports). However, when I try one of the Qt4 examles:
>>>
>>> python
>>> /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py
>>>
>>>
>>> IOError: [Errno 4] Interrupted system call
>>>
>>> Any ideas on what could be causing this?
>>> 
>> Out of curiosity, does anyone know where the signal interrupting the
>> system call is originating? Is this a standard communication mechanism
>> within Qt4? (I have never used Qt4.) I'm interested in knowing about OSS
>> that use signals as a means of across-thread or across-process
>> communication.
>> 
>
> This problem arises when signal handlers are installed, not necessarily when a 
> signal itself is sent (dtrace doesn't detect any).
Hmm, but a system call isn't going to get interrupted and return EINTR 
by any means other than a signal. So the OP must have had a signal 
interrupting the call and it must have come from somewhere. Or... am I 
wrong?
> PyQt4 doesn't do it, but I 
> think something in QApplication does. I really don't know what, though. Here are 
> the files that call signal(3) or sigaction(3):
>
> ./src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
> ./src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
> ./src/3rdparty/sqlite/shell.c
> ./src/3rdparty/webkit/JavaScriptCore/jsc.cpp
> ./src/corelib/io/qfilesystemwatcher_dnotify.cpp
> ./src/corelib/io/qprocess_unix.cpp
> ./src/corelib/kernel/qcrashhandler.cpp
> ./src/corelib/kernel/qeventdispatcher_unix.cpp
> ./src/gui/embedded/qwindowsystem_qws.cpp
> ./src/gui/embedded/qwssignalhandler.cpp
> ./tools/qvfb/main.cpp
>
> It's not obvious to me that any of these are activated on OS X (the 
> qcrashhandler.cpp file is intriguing, but it only seems to be used in the X11 
> QApplication). dtrace doesn't actually show either signal(3) or sigaction(3) 
> being called at all. Actually, running a program under dtrace while probing 
> those functions makes the problem go away. Sometimes.
> 
Ahh, a fun Heisenbug. OK, well if I decide to look for programs that use 
signals as a means of communication, I'll investigate Qt further.
I asked because there's a proprietary library I'm forced to use that 
does communicate internally with signals. It's a real pain, however, 
because it means anything else in that process also gets hit with 
signals and so system calls must be EINTR safe.
-Andrew
From: Gael V. <gae...@no...> - 2009年11月12日 22:33:00
On Wed, Nov 04, 2009 at 08:56:49PM +0100, qu...@gm... wrote:
> I would like to make a mplot3d.bar3d plot where the colour indicates
> the value of the element. Like: negative values blue, positive red,
> zero green. From what i see i can only give all bars the same 
> color ... Is there a way around it?
Hi,
I am afraid I do not know how to help you with the issue, as I don't know
mplot3d well-enough.
> I know that this is currently done in mayavi, but mayavi also
> seems to be tons slower.
That's interesting. For my use, Mayavi is most of the time faster. Do you
have a light-weight example that would reproduce this slugginess, to see
if we can improve things?
Cheers,
Gaël
From: Christopher B. <Chr...@no...> - 2009年11月12日 21:59:25
Geoffrey Ely wrote:
> Hi, What is the best way to rasterize a figure into a numpy array for 
> further image processing?
untested, but I suspect:
> image = numpy.frombuffer( fig.canvas.renderer.buffer_rgba).reshape( shape )
might work -- something like that, anyway.
-CHB
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Robert K. <rob...@gm...> - 2009年11月12日 21:33:44
On 2009年11月12日 12:05 PM, Andrew Straw wrote:
> Celil Rufat wrote:
>> I just installed matplotlib on Snow Leopard 10.6 with the Qt4 backend
>> (via macports). However, when I try one of the Qt4 examles:
>>
>> python
>> /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py
>>
>>
>> IOError: [Errno 4] Interrupted system call
>>
>> Any ideas on what could be causing this?
> Out of curiosity, does anyone know where the signal interrupting the
> system call is originating? Is this a standard communication mechanism
> within Qt4? (I have never used Qt4.) I'm interested in knowing about OSS
> that use signals as a means of across-thread or across-process
> communication.
This problem arises when signal handlers are installed, not necessarily when a 
signal itself is sent (dtrace doesn't detect any). PyQt4 doesn't do it, but I 
think something in QApplication does. I really don't know what, though. Here are 
the files that call signal(3) or sigaction(3):
./src/3rdparty/freetype/src/tools/ftrandom/ftrandom.c
./src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
./src/3rdparty/sqlite/shell.c
./src/3rdparty/webkit/JavaScriptCore/jsc.cpp
./src/corelib/io/qfilesystemwatcher_dnotify.cpp
./src/corelib/io/qprocess_unix.cpp
./src/corelib/kernel/qcrashhandler.cpp
./src/corelib/kernel/qeventdispatcher_unix.cpp
./src/gui/embedded/qwindowsystem_qws.cpp
./src/gui/embedded/qwssignalhandler.cpp
./tools/qvfb/main.cpp
It's not obvious to me that any of these are activated on OS X (the 
qcrashhandler.cpp file is intriguing, but it only seems to be used in the X11 
QApplication). dtrace doesn't actually show either signal(3) or sigaction(3) 
being called at all. Actually, running a program under dtrace while probing 
those functions makes the problem go away. Sometimes.
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Dan K. <dkl...@mr...> - 2009年11月12日 21:09:18
I have installed Python 2.6.4 and matplotlib-0.99.1 on my windows machine (XP). When trying to use Tkinter I get an error message that says it can not find the right version of Tcl. 
Where can I find the right binaries to load on my windows machine?
cheers, Dan
Daniel A. Klinglesmith III
Magdalena Ridge Observatory
New Mexico Tech
(575) 835-6802
From: Eric F. <ef...@ha...> - 2009年11月12日 19:38:25
Geoffrey Ely wrote:
> On Nov 12, 2009, at 10:03 AM, Eric Firing wrote:
>> Geoffrey Ely wrote:
>>> Ryan,
>>> I have noticed the same issue with contourf. It seems to be a thin 
>>> gap between neighboring polygons showing through. You can turn on 
>>> a thin contour line of the same color to cover the gap:
>>> for c in pylab.contourf( x, y, z ).collections:
>>> c.set_linewidth( 0.1 )
>>> Not ideal, but it works.
>> This is a good workaround so long as you leave alpha=1 and don't 
>> mind the very slight position shifts caused by stroking the line.
> 
> Yes, the position shift I don't like. Would be better if there was a 
> way to set the zorder of the line lower than the polygon. Maybe a 
> better workaround is to just do a line contour() before the contourf()?
Unfortunately, that won't work in general, because the code path for 
contour differs from that for contourf such that the patch boundaries 
don't always coincide with the corresponding contour lines. Generating 
filled contours is more complicated than generating line contours.
Eric
> 
> contour( x, y, z )
> contourf( x, y, z )
> 
> -Geoff
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Marius J. K. <mj...@ny...> - 2009年11月12日 19:36:53
Hi everyone,
I want to edit the metadata of pdf- or png-files when creating one of these files. I do not want to use for example Pypdf because then Python must read the file first before it can be edited. 
Does anyone know how to deal with that?
From: Geoffrey E. <ge...@us...> - 2009年11月12日 19:11:10
Hi, What is the best way to rasterize a figure into a numpy array for 
further image processing? The code I have below works, but I am 
wondering if there is a more convenient way.
Thanks in advance, Geoff
import pylab, numpy
fig = pylab.figure()
pylab.plot( [1, 2, 1] )
dpi = fig.get_dpi()
size = fig.get_size_inches()
shape = size[1] * dpi, size[0] * dpi, 3
image = fig.canvas.renderer.tostring_rgb()
image = numpy.fromstring( image, 'u1' ).reshape( shape )
pylab.imshow( image )
From: Geoffrey E. <ge...@us...> - 2009年11月12日 18:33:06
On Nov 12, 2009, at 10:03 AM, Eric Firing wrote:
> Geoffrey Ely wrote:
>> Ryan,
>> I have noticed the same issue with contourf. It seems to be a thin 
>> gap between neighboring polygons showing through. You can turn on 
>> a thin contour line of the same color to cover the gap:
>> for c in pylab.contourf( x, y, z ).collections:
>> c.set_linewidth( 0.1 )
>> Not ideal, but it works.
>
> This is a good workaround so long as you leave alpha=1 and don't 
> mind the very slight position shifts caused by stroking the line.
Yes, the position shift I don't like. Would be better if there was a 
way to set the zorder of the line lower than the polygon. Maybe a 
better workaround is to just do a line contour() before the contourf()?
contour( x, y, z )
contourf( x, y, z )
-Geoff
From: Jae-Joon L. <lee...@gm...> - 2009年11月12日 18:29:46
On Thu, Nov 12, 2009 at 12:07 PM, per freem <per...@gm...> wrote:
> ax.axis["xzero"].set_visible(True)
> # make other axis (bottom, top, right) invisible.
The ax.axis["xzero"] is drawn along the y=0 line. Therefore, if you
use logscale, this axis become invisible.
> invisible = ["bottom", "top", "right"]
> for n in invisible:
>  ax.axis[n].set_visible(False)
>
Is there any reason that you have to use SubplotZero? If you intend to
use it, you need to place the "xzero" axes not at y=0, but at some
meaningful location.
However, I think you're good without SubplotZero. Just use Subplot,
but do not make "bottom" axis invisible (see the example below).
On the other hand, I recommend you to consider using spines instead of
axes_grid toolkits.
 http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html
Regards,
-JJ
from mpl_toolkits.axes_grid.axislines import Subplot
fig = plt.figure(figsize=(5, 5), dpi=100)
ax = Subplot(fig, 1, 1, 1)
ax = fig.add_subplot(ax)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
ax = plt.gca()
ax.set_yscale('log')
invisible = ["top", "right"]
for n in invisible:
 ax.axis[n].set_visible(False)
From: Eric F. <ef...@ha...> - 2009年11月12日 18:11:13
Ryan Neve wrote:
> Thank you for the suggestion, but I couldn't see a difference with 
> "antialiased" either True or False. The lines between contour levels remain.
> I tried a different colormap (spectral) but it had the same effect. I 
> tried more color levels (256) but the effect got worse.
> 
> I can't find any example pictures online of matplotlib's contourf() 
> producing a "smooth" plot, I know matlab's does it:
> http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
That looks to me like a pcolor plot, not a contourf plot, regardless of 
what the file name says. And, maybe it is my eyes, but it looks to me 
like there are artifacts in the colorbar. In any case, if you are 
plotting a very densely sampled data set, you may want to use the 
Axes.pcolorfast method or the pcolormesh function or method instead of 
contourf. Contouring, filled or not, is suitable for data in which you 
want to bring out a moderate number of regions, not for data with highly 
complex structure and texture, or if you want essentially a smooth color 
progression.
Eric
> 
> 
> -Ryan
> 
> On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha... 
> <mailto:ef...@ha...>> wrote:
> 
> Ryan Neve wrote:
> 
> Hello,
> In my filled contour plot: http://imgur.com/vXoCL.png
> There are faint lines between the contour levels. I think they
> are yellow since they disappear in the yellow parts of the graph
> and are most obvious in the red areas. Is there any way to get
> rid of these lines? The number of contour levels is arbitrary,
> and I don't need them emphasized with a moire pattern.
> 
> 
> Try experimenting with the "antialiased" kwarg in your call to
> contourf. It is a boolean; see if a value of True or False gives a
> better result.
> 
> Eric
> 
> 
> Thank you,
> 
> -Ryan
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports
> 2008 30-Day trial. Simplify your report design, integration and
> deployment - and focus on what you do best, core application
> coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
From: Gregor T. <gre...@gm...> - 2009年11月12日 18:11:09
Hi all,
I want to use matplotlib to plot in realtime the position of a microscope
stage, read out over a serial connection. Essentially I reached my goal,
starting from the example simple_idle_wx.py
http://matplotlib.sourceforge.net/examples/animation/simple_idle_wx.html
Now I have two questions
1) I would like to stay independent of the backend, therefore I would prefer
a approach like in idle_and_timeout
http://matplotlib.sourceforge.net/examples/event_handling/idle_and_timeout.html
However, with my default backend WXAgg I do not continuously idle events,
but only once e.g. after each mouse movement. Can someone give me more
information about the intended behaviour, current status and support of idle
events?
2) I want to limit the lifetime of my connection object, that takes care of
the communication with the microscope stage, so that the connection is
closed if I close the matplotlib figure. I could not find a 'close_event'.
To achieve this I could embed a matplotlib figure into a wx frame, but this
is somewhat tediuos. For the wxagg backend, does somebody know a more simple
solution? Do others also feel the need to add a close_event? In case, I
could try to take care of the wx backend.
Gregor
From: Andrew S. <str...@as...> - 2009年11月12日 18:05:24
Celil Rufat wrote:
> I just installed matplotlib on Snow Leopard 10.6 with the Qt4 backend 
> (via macports). However, when I try one of the Qt4 examles:
>
> python 
> /opt/local/share/py26-matplotlib/examples/user_interfaces/embedding_in_qt4.py
>
>
> IOError: [Errno 4] Interrupted system call
>
> Any ideas on what could be causing this?
Out of curiosity, does anyone know where the signal interrupting the 
system call is originating? Is this a standard communication mechanism 
within Qt4? (I have never used Qt4.) I'm interested in knowing about OSS 
that use signals as a means of across-thread or across-process 
communication.
From: Eric F. <ef...@ha...> - 2009年11月12日 18:03:33
Geoffrey Ely wrote:
> Ryan,
> 
> I have noticed the same issue with contourf. It seems to be a thin gap 
> between neighboring polygons showing through. You can turn on a thin 
> contour line of the same color to cover the gap:
> 
> for c in pylab.contourf( x, y, z ).collections:
> c.set_linewidth( 0.1 )
> 
> Not ideal, but it works.
This is a good workaround so long as you leave alpha=1 and don't mind 
the very slight position shifts caused by stroking the line.
The fundamental problem is in the rendering of adjacent patches, which 
varies with the renderer. I don't know that there is any one that does 
it perfectly. As of the last time I looked, several years ago, the way 
Matlab avoided the problem is by layering the patches instead of 
rendering them as adjacent. In other words, a background is colored, 
then everything above the lowest level gets its color, and then 
everything above the next level gets the next color, etc. This works 
fine if there is no transparency, but is not an option for us because 
mpl is committed to transparency support.
So, all this is an annoying longstanding problem with no good solution 
in sight.
> 
> -Geoff
> 
> On Nov 12, 2009, at 5:42 AM, Ryan Neve wrote:
> 
>> Thank you for the suggestion, but I couldn't see a difference with 
>> "antialiased" either True or False. The lines between contour levels 
>> remain.
That's strange--it really should make a visible difference, even if 
neither version is perfect.
What mpl version are you using?
Eric
>> I tried a different colormap (spectral) but it had the same effect. 
>> I tried more color levels (256) but the effect got worse.
>>
>> I can't find any example pictures online of matplotlib's contourf() 
>> producing a "smooth" plot, I know matlab's does it:
>> http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
>>
>>
>> -Ryan
>>
>> On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha...> 
>> wrote:
>> Ryan Neve wrote:
>> Hello,
>> In my filled contour plot: http://imgur.com/vXoCL.png
>> There are faint lines between the contour levels. I think they are 
>> yellow since they disappear in the yellow parts of the graph and are 
>> most obvious in the red areas. Is there any way to get rid of these 
>> lines? The number of contour levels is arbitrary, and I don't need 
>> them emphasized with a moire pattern.
>>
>> Try experimenting with the "antialiased" kwarg in your call to 
>> contourf. It is a boolean; see if a value of True or False gives a 
>> better result.
>>
>> Eric
>>
>>
>> Thank you,
>>
>> -Ryan
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
>> 30-Day trial. Simplify your report design, integration and 
>> deployment - and focus on what you do best, core application coding. 
>> Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and 
>> focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jouni K. S. <jk...@ik...> - 2009年11月12日 17:33:47
Attachments: eintr.patch
Celil Rufat <cel...@gm...> writes:
> However, when I try one of the Qt4 examles:
[...]
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py",
> line 303, in get_fontconfig_fonts
> status, output = commands.getstatusoutput("fc-list file")
> File
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py",
> line 56, in getstatusoutput
> text = pipe.read()
> IOError: [Errno 4] Interrupted system call
I believe the attached patch (already committed to the trunk) should fix
this on Python 2.6, but I don't have a Qt installation to try it out
with. Can you try this on your system?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Taro S. <ub...@gm...> - 2009年11月12日 17:13:21
TheLonelyStar wrote:
> 
> 
> /net/gorgonzola/storage/nhuesken/svn/ActiveLearning/SVM/ModelSelection/Ergebnisse/plot.pyc
> in plot(filename, line_list, name_list, reference)
> 6 for i in xrange(len(line_list)):
> 7 
> plt.plot(m[:,reference],m[:,line_list[i]],label=name_list[i])
> 8 plt.legend(loc='best')
> ----> 9 plt.show()
> 10 
> 
> 
Are you calling plt.show() more than once within a script? If so, I was
having a similar issue, but after reading this FAQ entry:
 http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
I realized that the specific usage of show() is not supported (yet);
plt.show() can only be used once within a script. Out of luck! 
I hope there is a resolution one way or the other, since it will make
matplotlib so much more useful than it already is.
Cheers,
Taro
-- 
View this message in context: http://old.nabble.com/matplotlib-WX-and-Qt4Agg-backends-tp26315069p26322550.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: per f. <per...@gm...> - 2009年11月12日 17:07:59
thanks to all for the replies. i am still having an issue with the log
scale of these plots. i am trying to hide the top and right axes of
the plot, since these should not be there when plotting a histogram or
a line plot. i use the following code:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10
from mpl_toolkits.axes_grid.axislines import SubplotZero
fig = plt.figure(figsize=(5, 5), dpi=300)
ax = SubplotZero(fig, 1, 1, 1)
ax = fig.add_subplot(ax)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
ax = plt.gca()
ax.set_yscale('log')
ax.axis["xzero"].set_visible(True)
# make other axis (bottom, top, right) invisible.
invisible = ["bottom", "top", "right"]
for n in invisible:
 ax.axis[n].set_visible(False)
plt.savefig('test_logscale.pdf')
if i do this, the bottom x-axis labels disappear.
 this only happens with SubplotZero -- which is needed to make the
irrelevant axes invisible, I think -- then the labels of the x-axis
disappear.
any idea how this can be fixed? i want those axes removed but i still
want the labels/ticks of the bottom x-axis to show.
thanks.
On 11/11/09, Gökhan Sever <gok...@gm...> wrote:
> On Wed, Nov 11, 2009 at 4:25 PM, per freem <per...@gm...> wrote:
>> hi all,
>>
>> I am trying to make a simple bar graph that has its yaxis scale set to
>> log. I use the following code:
>>
>> import matplotlib
>> matplotlib.use('PDF')
>> import matplotlib.pyplot as plt
>> from matplotlib import rc
>> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>> plt.rcParams['ps.useafm'] = True
>> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>> plt.rcParams['pdf.fonttype'] = 42
>> plt.rcParams['font.size'] = 10
>>
>> x = range(1, 11)
>> y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
>> plt.figure(figsize=(5, 5), dpi=300)
>
>> plt.bar(x, y)
>
> It should work scaling from within the bar()
> plt.bar(x, y, log=True)
>
> # plt.gca().set_yscale('log')
>
>> plt.savefig('test_logscale.pdf')
>>
>> the problem is that the bar graphs do not appear -- instead, i simply
>> get horizontal lines around where the top of the bar graph should
>> appear. Any idea how to fix this?
>>
>> also, sometimes the x axis disappears when i try this. thanks.
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> --
> Gökhan
>
From: Geoffrey E. <ge...@us...> - 2009年11月12日 16:59:48
Ryan,
I have noticed the same issue with contourf. It seems to be a thin gap 
between neighboring polygons showing through. You can turn on a thin 
contour line of the same color to cover the gap:
for c in pylab.contourf( x, y, z ).collections:
 c.set_linewidth( 0.1 )
Not ideal, but it works.
-Geoff
On Nov 12, 2009, at 5:42 AM, Ryan Neve wrote:
> Thank you for the suggestion, but I couldn't see a difference with 
> "antialiased" either True or False. The lines between contour levels 
> remain.
> I tried a different colormap (spectral) but it had the same effect. 
> I tried more color levels (256) but the effect got worse.
>
> I can't find any example pictures online of matplotlib's contourf() 
> producing a "smooth" plot, I know matlab's does it:
> http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
>
>
> -Ryan
>
> On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha...> 
> wrote:
> Ryan Neve wrote:
> Hello,
> In my filled contour plot: http://imgur.com/vXoCL.png
> There are faint lines between the contour levels. I think they are 
> yellow since they disappear in the yellow parts of the graph and are 
> most obvious in the red areas. Is there any way to get rid of these 
> lines? The number of contour levels is arbitrary, and I don't need 
> them emphasized with a moire pattern.
>
> Try experimenting with the "antialiased" kwarg in your call to 
> contourf. It is a boolean; see if a value of True or False gives a 
> better result.
>
> Eric
>
>
> Thank you,
>
> -Ryan
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
> 30-Day trial. Simplify your report design, integration and 
> deployment - and focus on what you do best, core application coding. 
> Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
> 30-Day
> trial. Simplify your report design, integration and deployment - and 
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ryan N. <ne...@em...> - 2009年11月12日 15:26:44
Thank you for the suggestion, but I couldn't see a difference with
"antialiased" either True or False. The lines between contour levels remain.
I tried a different colormap (spectral) but it had the same effect. I tried
more color levels (256) but the effect got worse.
I can't find any example pictures online of matplotlib's contourf()
producing a "smooth" plot, I know matlab's does it:
http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
-Ryan
On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha...> wrote:
> Ryan Neve wrote:
>
>> Hello,
>> In my filled contour plot: http://imgur.com/vXoCL.png
>> There are faint lines between the contour levels. I think they are yellow
>> since they disappear in the yellow parts of the graph and are most obvious
>> in the red areas. Is there any way to get rid of these lines? The number of
>> contour levels is arbitrary, and I don't need them emphasized with a moire
>> pattern.
>>
>
> Try experimenting with the "antialiased" kwarg in your call to contourf. It
> is a boolean; see if a value of True or False gives a better result.
>
> Eric
>
>
>> Thank you,
>>
>> -Ryan
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment - and
>> focus on what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
From: Tony S Yu <to...@MI...> - 2009年11月12日 15:03:33
On Nov 12, 2009, at 8:16 AM, Michael Droettboom wrote:
> Thanks for looking into this further. Can you file a bug with this 
> script that appears differently in the PDF/PS/SVG/Agg backends vs. 
> Mac OS X?
Bug filed. Thanks for your response.
-Tony
>
> Cheers,
> Mike
>
> Tony S Yu wrote:
>>
>> On Nov 11, 2009, at 1:33 PM, Michael Droettboom wrote:
>>
>>> Which older revision (or release) worked as you expected?
>>
>> After some digging, I think this issue is caused by an error in the 
>> macosx backend (everything works fine with tkagg, qt4agg, and agg). 
>> Oddly enough, calling savefig(), instead of show(), with the macosx 
>> backend creates the correct plot, but calling savefig() after show 
>> () does not.
>>
>> I'm actually not sure if my code worked for older revisions of the 
>> macosx backend (I may have had a different default backend before). 
>> The transform code doesn't work with revisions between 7950 and 
>> 7625; older versions break the macosx backend on my system (OS X 
>> 10.6.1).
>>
>> -Tony
>>
From: Michael D. <md...@st...> - 2009年11月12日 13:16:47
Thanks for looking into this further. Can you file a bug with this 
script that appears differently in the PDF/PS/SVG/Agg backends vs. Mac OS X?
Cheers,
Mike
Tony S Yu wrote:
>
> On Nov 11, 2009, at 1:33 PM, Michael Droettboom wrote:
>
>> Which older revision (or release) worked as you expected?
>
> After some digging, I think this issue is caused by an error in the 
> macosx backend (everything works fine with tkagg, qt4agg, and agg). 
> Oddly enough, calling savefig(), instead of show(), with the macosx 
> backend creates the correct plot, but calling savefig() after show() 
> does not.
>
> I'm actually not sure if my code worked for older revisions of the 
> macosx backend (I may have had a different default backend before). 
> The transform code doesn't work with revisions between 7950 and 7625; 
> older versions break the macosx backend on my system (OS X 10.6.1).
>
> -Tony
>
>
>>
>> Mike
>>
>> Tony S Yu wrote:
>>> Hi,
>>>
>>> Awhile back, Jae-Joon helped me transform collection sizes from 
>>> points to data values by overriding the `get_transform` method of 
>>> a RegularPolyCollection (see example code below).
>>>
>>> When I tried the code today, the collection didn't appear on the 
>>> plot. Removing the get_transform method below brings the collection 
>>> back, but of course, the sizes are not what I want.
>>>
>>> Some simple testing suggests that changing the transform returned 
>>> by `get_transform` changes the offsets of the collection items. In 
>>> other words, the transform originally (i.e. in some older revision) 
>>> modified only the scale of collection items, but now appears to 
>>> modify both the scale and offset.
>>>
>>> Is there a way to modify only the scale of collection items?
>>>
>>> Thanks,
>>> -Tony
>>>
>>> BTW, I'm on svn r7950.
>>>
>>> #-----------------
>>> # The squares will not show up with the code below
>>> # Comment out the get_transform method to see squares
>>> # Change scale_x and scale_y to values close to 1 to see how they 
>>> change both scale and offset
>>>
>>> class SquareCollection(collections.RegularPolyCollection):
>>> """Return a collection of squares."""
>>>
>>> def __init__(self, **kwargs):
>>> super(SquareCollection, self).__init__(4, rotation=np.pi/4., 
>>> **kwargs)
>>>
>>> def get_transform(self):
>>> """Return transform scaling circle areas to data space."""
>>> ax = self.axes
>>> pts2pixels = 72.0 / ax.figure.dpi
>>> scale_x = pts2pixels * ax.bbox.width / ax.viewLim.width
>>> scale_y = pts2pixels * ax.bbox.height / ax.viewLim.height
>>> return transforms.Affine2D().scale(scale_x, scale_y)
>>>
>>> ax = plt.gca()
>>> circle_areas = np.pi * np.ones(4)
>>> xy = [(0, 0), (0, 1), (1, 0), (1, 1)]
>>> squares = SquareCollection(sizes=circle_areas,
>>> offsets=xy, transOffset=ax.transData,
>>> facecolor='black')
>>> ax.add_collection(squares, autolim=True)
>>> plt.axis([-0.5, 1.5, -0.5, 1.5])
>>> plt.show()
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------ 
>>>
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 
>>> 30-Day trial. Simplify your report design, integration and 
>>> deployment - and focus on what you do best, core application coding. 
>>> Discover what's new with
>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>> -- 
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Showing results of 27

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