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 346

<< < 1 .. 7 8 9 10 11 .. 14 > >> (Page 9 of 14)
From: per f. <per...@gm...> - 2009年11月13日 15:38:00
hi all,
i am trying to adjust the space (padding) between the tickmarks on an
axes and the labels. usually, i can do this by setting
'xtick.major.pad' and 'xtick.minor.pad' (and same for y-axis) in
rcParams. however, when i try to do this with a figure made using the
"SubplotZero" function, it seems to only work for the y-axis and not
the x-axis for some reason -- here is an example:
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
def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
 plt.rcParams['ytick.major.pad'] = 2
 plt.rcParams['ytick.minor.pad'] = 2
 # Y ticks work, but X tick do not...
 plt.rcParams['xtick.major.pad'] = 0.01
 plt.rcParams['xtick.minor.pad'] = 0.01
 ax = SubplotZero(fig, 1, 1, 1)
 fig.add_subplot(ax)
 # make xzero axis (horizontal axis line through y=0) visible.
 ax.axis["xzero"].set_visible(True)
 # make other axis (bottom, top, right) invisible.
 for n in invisible:
 ax.axis[n].set_visible(False)
 return ax
fig = plt.figure(figsize=(5, 5), dpi=300)
setup_axes(fig, labelpad=2)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y)
ax = plt.gca()
plt.savefig('test.pdf')
i am seeing the ylabels get closer to the y-axis, but the x-axis seems
to have no effect. it seems to be related to SubplotZero since
otherwise in ordinary plots this works fine. any idea how this could
be fixed?
thanks very much for your help.
From: Jouni K. S. <jk...@ik...> - 2009年11月13日 15:23:24
Marius Jan Klein <mj...@ny...> writes:
> 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.
Concerning pdf files, there is no current support for that, but at least
the simplest form of metadata could be supported pretty easily (the
document information dictionary - title, author, subject, keywords,
creator, producer, creation date, modification date). What sort of API
do you have in mind?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Fabrice S. <si...@lm...> - 2009年11月13日 10:52:42
r7591 introduced an extra argument in the call of
fig.canvas.stop_event_loop in the mouse_event_stop method of the
BlockingMouseInput class (in blocking_input.py line 199).
But, in the GTK backend, fig.canvas.stop_event_loop only takes the
instance object as input.
I can't figure out whether the change in r7591 is linked to a change in
a particular backend other than GTK*...
-- 
Fabrice Silva
Laboratory of Mechanics and Acoustics - CNRS
31 chemin Joseph Aiguier, 13402 Marseille, France.
From: Celil R. <cel...@gm...> - 2009年11月13日 08:28:42
Thanks!
I can confirm the patches fixes the issue on my computer.
Celil
On Thu, Nov 12, 2009 at 9:33 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> 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
>
>
>
> ------------------------------------------------------------------------------
> 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: Geoffrey E. <ge...@us...> - 2009年11月13日 02:12:13
On Nov 12, 2009, at 4:32 PM, Jae-Joon Lee wrote:
> shape = fig.canvas.get_width_height()[::-1] + (4,)
>
> im = np.frombuffer(fig.canvas.buffer_rgba(0,0),
> dtype=np.uint8).reshape(shape)
>
> Using buffer_rgba is more efficient than using tostring_rgb as no
> memory is allocated. But, I believe that "im" is a read-only "view" of
> the canvas. So, you must make a copy if you want to show it with
> imshow as in your original code.
>
> If you're using PIL,
>
> import PIL.Image
>
> im2=PIL.Image.frombuffer("RGBA", fig.canvas.get_width_height(),
> fig.canvas.buffer_rgba(0,0), "raw", "RGBA", 
> 0, 1)
Work perfectly. Thanks, JJ!
-Geoff
From: Eric F. <ef...@ha...> - 2009年11月13日 01:15:42
Ryan Neve wrote:
> 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
It looks to me like this is more suitable for showing your data than 
contourf would be.
> 
> 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.
And again, I think contourf makes sense with 10-20 levels, but not with 256.
> 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.
Do you really want to smooth it, or do you want to simply show the data? 
 You have big jumps from one sample time to the next. I don't see that 
it makes sense to to smooth heavily in the vertical; but I don't know 
what kind of measurement you are plotting or for what purpose.
> 
> I'm not familiar with pcolorfast & pcolormesh, but I'll look in to that 
> tomorrow.
They are less general than pcolor, but much faster.
Eric
> 
> Many Thanks,
> 
> -Ryan
> 
> On Thu, Nov 12, 2009 at 1:11 PM, Eric Firing <ef...@ha... 
> <mailto: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...> <mailto: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: Jae-Joon L. <lee...@gm...> - 2009年11月13日 00:32:50
On Thu, Nov 12, 2009 at 6:32 PM, Geoffrey Ely <ge...@us...> wrote:
> Thanks for the help. With that I get:
>
> AttributeError: 'function' object has no attribute '__buffer__'
>
>
shape = fig.canvas.get_width_height()[::-1] + (4,)
im = np.frombuffer(fig.canvas.buffer_rgba(0,0),
 dtype=np.uint8).reshape(shape)
Using buffer_rgba is more efficient than using tostring_rgb as no
memory is allocated. But, I believe that "im" is a read-only "view" of
the canvas. So, you must make a copy if you want to show it with
imshow as in your original code.
If you're using PIL,
import PIL.Image
im2=PIL.Image.frombuffer("RGBA", fig.canvas.get_width_height(),
 fig.canvas.buffer_rgba(0,0), "raw", "RGBA", 0, 1)
Regards,
-JJ
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
11 messages has been excluded from this view by a project administrator.

Showing results of 346

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