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



Showing 17 results of 17

From: John T W. <joh...@li...> - 2007年01月26日 22:13:28
I just installed matplotlib 0.87.5 and numpy 1.0 from source on my
Debian "sarge" (stable release) system. (I chose those versions
because they're the ones currently included in the testing "etch"
release.) Everything I've tried has worked *except* the ylabel()
command. Whenever a plot containing a ylabel is rendered (on the
screen with show() or figure(), or non-interactively with savefig()),
python exits with the error
Floating exception
This does not happen if the ylabel() command is omitted, and there is
no problem with xlabel(), so I assume the issue is rotating the text
for the y axis label.
Simple example:
==================================================
> ipython -pylab
/usr/lib/python2.3/site-packages/numpy/ctypeslib.py:12: UserWarning: All features of ctypes interface may not work with ctypes < 1.0.1
 warnings.warn("All features of ctypes interface may not work with " \
/usr/lib/python2.3/site-packages/IPython/Shell.py:628: GtkDeprecationWarning: gtk.timeout_add is deprecated, use gobject.timeout_add instead
 self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
Python 2.3.5 (#2, Oct 16 2006, 19:19:48) 
Type "copyright", "credits" or "license" for more information.
IPython 0.6.13 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
 Welcome to pylab, a matplotlib-based Python environment.
 For more information, type 'help(pylab)'.
In [1]: plot([0, 1],[0, 1]) 
Out[1]: [<matplotlib.lines.Line2D instance at 0xb5b46f2c>]
In [2]: xlabel('foo')
Out[2]: <matplotlib.text.Text instance at 0xb5b2d4cc>
In [3]: ylabel('bar')
Floating exception
==================================================
Anyone have experience with this and care to point me towards the
solution to such a problem?
 				Thanks,
-- 
======================================================================
Office: 0.17 (Golm) Dr. John T. Whelan
Phone: +49 331 567 7117 Albert-Einstein Institute
FAX: +49 331 567 7298 Am Muehlenberg 1
http://www.aei.mpg.de/~whelan/ D-14476 Potsdam
joh...@li... joh...@ae...
======================================================================
From: Fernando P. <fpe...@gm...> - 2007年01月26日 21:29:18
On 1/25/07, Alan G Isaac <ai...@am...> wrote:
> On 2007年1月24日, Fernando Perez apparently wrote:
> > Let us know if this is not enough or if you have any other issues.
>
> How about for Windows users? You list as dependencies:
>
> # PyWin32 from http://starship.python.net/crew/mhammond
>
> But that link is broken. Can we just use
> pywin32-210.win32-py2.5.exe from
> http://sourceforge.net/projects/pywin32/ ?
Yes, should be the same thing.
> # CTypes from http://starship.python.net/crew/theller/ctypes
>
> But that should not apply to Python 2.5+, right?
Correct, ctypes is now included.
> # PyReadline for Windows from
> http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro
>
> But the correct link now seems to be
> http://ipython.scipy.org/moin/PyReadline/Intro
> and the binary installer instructions there are Python
> 2.4 specific. (I assume they translate directly to 2.5.)
Yup.
We obviously need to update the windows documentation...
> So I installed PyWin32 as above, and PyReadline. I do NOT
> see IPython in my Start Menu nor when I look at
> Install/Uninstall programs. I do see an IPython folder in
> Lib/site-packages, so I guessed I should call Shell.py, but
> this is either a bad guess or IPython is failing: I briefly
> see a shell labelled IPython flash on screen and disappear.
As Dave said, you may need to run the post-install script manually.
The binary win32 installer does this for you because when the
installer is /built/, it is told what to do as a post-install step.
But a manual installation from source may require that step to be
applied manually (it's been years since I wrote that code, and much of
the win32 setup has been changed since by others, so take anything I
say here with a big grain of salt).
Cheers,
f
From: George N. <gn...@go...> - 2007年01月26日 18:57:37
Attachments: alpha_test.svg
I'm trying to work out a way of printing plots as vector graphics that
use alpha channel.
I understand that postscript doesn't do alpha, so I was hoping to save
the plot as svg, import into illustrator and then save as a pdf and/or
print.
So I run the following file: (matplotlib svn 2943, os x, WXAgg back end)
from pylab import *
from numpy import *
rx, ry = 1.8, 1.
area = rx * ry * pi
theta = arange(0, 2*pi+0.01, 0.1)
verts = zip(rx/area*cos(theta), ry/area*sin(theta))
x = [0,0.1,0.2, 0.5,0.43]
y = [0.,0.1,0.,0.20,.2]
scatter(x,y, c='r', edgecolor='k', faceted=True, s=300, marker=None,
verts=verts, alpha=0.2)
y = array(y) + 0.01
scatter(x,y, c='g', edgecolor='k', faceted=True, s=300, marker=None,
verts=verts, alpha=0.2)
savefig('alpha_test.svg')
Unfortunately if I import alpha_test.svg into Illustrator or Inkscape,
the ellipses appear completely solid. Saving directly as .pdf produces
a solid image as well.
However, if I save the figure as .png, the ellipses are transparent.
I had the same problem running a slightly earlier version of
matplotlib on a Linux box with GTKAgg
Regards, George Nurser.
From: John H. <jdh...@ac...> - 2007年01月26日 18:08:36
>>>>> "Lars" == Lars Friedrich <lfr...@im...> writes:
 Lars> Hello, how can I use the pylab.psd-function without a
 Lars> matplotlib-Plot-figure popping up?
>From matplotlib.mlab import psd
JDH
From: Jay P. <pa...@gm...> - 2007年01月26日 17:50:06
On 1/26/07, John Hunter <jdh...@ac...> wrote:
> >>>>> "Jay" == Jay Parlar <pa...@gm...> writes:
>
> Jay> That's the problem, I believe. 'imread' in mpl always reads
> Jay> images in as MxNx4, while Matlab will check if the image is
> Jay> B&W and just do MxN. Is there any way to force MxN behaviour
> Jay> in mpl?
>
> No way currently, but one could modify the png reader to do it....
> Probably easiest is to use PIL and get a grayscale numpy array out,
> then mpl's colormapping and normalization will work as advertised.
Beautiful, that worked like a charm.
from PIL import Image
im = Image.open("4kSnake.png")
a = scipy.asarray(im)
ft = fftpack.fftshift(fftpack.fft2(a))
...
Perfect!
Thanks so much,
Jay P.
From: Lars F. <lfr...@im...> - 2007年01月26日 17:50:03
Hello,
how can I use the pylab.psd-function without a matplotlib-Plot-figure
popping up?
Thanks
Lars
-- 
Dipl.-Ing. Lars Friedrich
Optical Measurement Technology
Department of Microsystems Engineering -- IMTEK
University of Freiburg
Georges-Köhler-Allee 102
D-79110 Freiburg
Germany
phone: +49-761-203-7531
fax: +49-761-203-7537
room: 01 088
email: lfr...@im...
From: John H. <jdh...@ac...> - 2007年01月26日 17:40:43
>>>>> "Jay" == Jay Parlar <pa...@gm...> writes:
 Jay> That's the problem, I believe. 'imread' in mpl always reads
 Jay> images in as MxNx4, while Matlab will check if the image is
 Jay> B&W and just do MxN. Is there any way to force MxN behaviour
 Jay> in mpl?
No way currently, but one could modify the png reader to do it....
Probably easiest is to use PIL and get a grayscale numpy array out,
then mpl's colormapping and normalization will work as advertised.
JDH
From: Jay P. <pa...@gm...> - 2007年01月26日 16:41:40
On 1/26/07, John Hunter <jdh...@ac...> wrote:
> >>>>> "Darren" == Darren Dale <dd...@co...> writes:
>
> Darren> vmin and vmax dont seem to have any effect on the
> Darren> resulting image, at least on my machine with the most
> Darren> recent svn.
>
> I haven't looked at his data or the output if fftshift. if vmin and
> vmax do nothing, mpl is probably interpreting his image as RGB or
> RGBA, which it would do if the output is MxNx3 or MxNx4 and thus would
> not be applying scaling or color mapping. When using svn, vmin and
> vmax do behave as expected in my test code:
That's the problem, I believe. 'imread' in mpl always reads images in
as MxNx4, while Matlab will check if the image is B&W and just do MxN.
Is there any way to force MxN behaviour in mpl?
Jay P.
From: John H. <jdh...@ac...> - 2007年01月26日 16:37:29
>>>>> "Darren" == Darren Dale <dd...@co...> writes:
 Darren> vmin and vmax dont seem to have any effect on the
 Darren> resulting image, at least on my machine with the most
 Darren> recent svn.
I haven't looked at his data or the output if fftshift. if vmin and
vmax do nothing, mpl is probably interpreting his image as RGB or
RGBA, which it would do if the output is MxNx3 or MxNx4 and thus would
not be applying scaling or color mapping. When using svn, vmin and
vmax do behave as expected in my test code:
In [3]: X = rand(10,10)
In [4]: subplot(211)
Out[4]: <matplotlib.axes.Subplot instance at 0xb5810f2c>
In [5]: imshow(X, vmin=0.45, vmax=.55)
Out[5]: <matplotlib.image.AxesImage instance at 0xb582516c>
In [6]: subplot(212)
Out[6]: <matplotlib.axes.Subplot instance at 0xb582af6c>
In [7]: imshow(X, vmin=0.0, vmax=1)
Out[7]: <matplotlib.image.AxesImage instance at 0xb58251ec>
I don't have time to look at this closely right now but maybe this
will give someone a hint...
JDH
From: Darren D. <dd...@co...> - 2007年01月26日 16:32:28
On Friday 26 January 2007 11:14, John Hunter wrote:
> >>>>> "Jay" == Jay Parlar <pa...@gm...> writes:
>
> Jay> One issue might be the use of "minAmp" and "maxAmp" in the
> Jay> Matlab code, and no equivalent in the Python. I thought maybe
> Jay> the vmin/vmax arguments to 'imshow' might work, but they
> Jay> don't make much of a difference.
>
> vmin and vmax do scale the image -- if they do not appear to make a
> difference you are probably choosing improper ranges.
vmin and vmax dont seem to have any effect on the resulting image, at least on 
my machine with the most recent svn.
> Jay> For all I know, this could be a scipy issue, and not a
> Jay> matplotlib one, but I thought I'd start at the top and work
> Jay> my way down.
>
> I suggest you start at the bottom and work your way up, and inspect
> the results of fftshift in matlab and scipy. imshow doesn't do all
> that much, so if you are seeing big differences it is more likely in
> my opinion that you are feeding in different values.
Aside from the ranges behaving strangely, something seems funny with the image 
itself. He selected the grey colormap, yet there are hints of yellow in the 
image.
Darren
From: Martin R. <law...@gm...> - 2007年01月26日 16:19:28
Attachments: widgets.py sliders.py
Hello everyone,
I was playing around with this /examples/widgets/sliders.py and thought about 
how to use it in my case. I'd like to controll a parameter which - if 
changed - starts a calculation which last about some seconds. So 
dragging=False would be exactly what I'm looking for! But on the other hand 
I'd like to see the slider moving and the value shown altering!
A look at the code in widgets.py made me think about how to change the code to 
achieve this. Here's my suggestion (my widgets.py is also attached):
docstring:
 update_func_only_on_release_event : The function specified by on_changed
 is normally updated on motion_notify_event if dragging is True.
 However if you don't want it to get updated (because it would take
 too long or whatever) but nevertheless want to see the slider moving
 then set dragging=True and update_func_only_on_release_event=True.
 (Therefore: dragging=False and
 update_func_only_on_release_event=False makes no sense and
 dragging=False makes update_func_only_on_release_event=True.)
def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
 closedmin=True, closedmax=True, slidermin=None,
 slidermax=None, dragging=True,
 update_func_only_on_release_event=False):
 ... snip ...
 if dragging:
 self.update_func_only_on_release_event = \
 update_func_only_on_release_event
 else:
 self.update_func_only_on_release_event = False
 ... snip ...
 ax.figure.canvas.mpl_connect('button_press_event', self._update)
 if dragging:
 ax.figure.canvas.mpl_connect('motion_notify_event', self._update)
 # VVV new #
 if self.update_func_only_on_release_event:
 ax.figure.canvas.mpl_connect('button_release_event', self._update)
 # ^^^ new #
 ... snip ...
def set_val(self, val, name):
 self.poly.xy[-1] = val, 0
 self.poly.xy[-2] = val, 1
 self.valtext.set_text(self.valfmt%val)
 if self.drawon: self.ax.figure.canvas.draw()
 self.val = val
 if not self.eventson: return
 # VVV new #
 if not self.update_func_only_on_release_event or \
 (name == 'button_release_event' and
 self.update_func_only_on_release_event):
 # ^^^ new #
 for cid, func in self.observers.items():
 func(val)
To see what happens I altered the example/widgets/slider.py to the one also 
attached.
So far so good. But I'm not really convinced by this change (are you?). I'm 
not sure if a list instead of dragging and update_func_only_on_release_event
would be better. Sliders could be initialized with two lists:
update_slider_on = ['button_press_event', 'motion_notify_event']
update_func_on = ['button_release_event']
The drawback here: A lot of all possible combinations are useless!
Please let me know what you're thinking about this.
Have a nice weekend
Martin
From: John H. <jdh...@ac...> - 2007年01月26日 16:14:46
>>>>> "Jay" == Jay Parlar <pa...@gm...> writes:
 Jay> One issue might be the use of "minAmp" and "maxAmp" in the
 Jay> Matlab code, and no equivalent in the Python. I thought maybe
 Jay> the vmin/vmax arguments to 'imshow' might work, but they
 Jay> don't make much of a difference.
vmin and vmax do scale the image -- if they do not appear to make a
difference you are probably choosing improper ranges.
 Jay> For all I know, this could be a scipy issue, and not a
 Jay> matplotlib one, but I thought I'd start at the top and work
 Jay> my way down.
I suggest you start at the bottom and work your way up, and inspect
the results of fftshift in matlab and scipy. imshow doesn't do all
that much, so if you are seeing big differences it is more likely in
my opinion that you are feeding in different values.
JDH
From: Jay P. <pa...@gm...> - 2007年01月26日 16:08:18
I'm trying to learn about 2D fourier transforms and k-space right now.
To do this, I'm using the image at
http://django.jayparlar.com/4kSnake.png
In Matlab, I run the following code:
Im = double(imread('4kSnake.png'));
FT = fftshift(fft2(Im));
FT_Amp = abs(FT);
minAmp = min(min(FT_Amp)); maxAmp = max(max(FT_Amp));
colormap gray;
imagesc(FT_Amp,[minAmp 0.01*maxAmp]);
and I get the result http://django.jayparlar.com/matlab.png (which is
what it should look like).
It matplotlib/ipython, I do the following:
In [53]: a = imread("4kSnake.png")
In [54]: a = double(imread("4kSnake.png"))
In [55]: FT = fftpack.fftshift(fftpack.fft2(a))
In [56]: FT_Amp = abs(FT)
In [57]: imshow(FT_Amp, cmap=cm.gray)
and I get the result http://django.jayparlar.com/matplotlib.png
Can anyone offer any insight as to why? I'm fairly new to matplotlib,
but I'm a LONG time Python user, and would much rather continue my
work in Python than Matlab.
One issue might be the use of "minAmp" and "maxAmp" in the Matlab
code, and no equivalent in the Python. I thought maybe the vmin/vmax
arguments to 'imshow' might work, but they don't make much of a
difference.
For all I know, this could be a scipy issue, and not a matplotlib one,
but I thought I'd start at the top and work my way down.
Many thanks,
Jay P.
From: John H. <jdh...@ac...> - 2007年01月26日 14:53:22
>>>>> "Jonathon" == Jonathon Anderson <and...@gm...> writes:
 Jonathon> Could someone point me to documentation of the oo
 Jonathon> interface? Everything seems to reference pylab (even
 Jonathon> examples that say they're for the oo interface).
 http://matplotlib.sourceforge.net/faq.html#OO
and 
 http://matplotlib.sourceforge.net/leftwich_tut.txt
and examples:
 > ls agg_oo.py embedding_in_*
 agg_oo.py 
 embedding_in_gtk.py 
 embedding_in_tk2.py
 embedding_in_wx3.py
 embedding_in_gtk2.py 
 embedding_in_qt4.py 
 embedding_in_tk.py
 embedding_in_wx4.py
 embedding_in_gtk3.py 
 embedding_in_qt.py 
 embedding_in_wx2.py
 embedding_in_wx.py
There is also a chapter in the User's Guide on the web site on the
API....
JDH
From: Lionel R. <lro...@li...> - 2007年01月26日 14:29:25
Hi,
using Agg, there's problems exporting plots in pdf format, all accentued=20
characters are not displayed (like u'accentu=C3=A9'), but they are in svg f=
iles.=20
In svg files, superscript characters are set to subscript (using TeX=20
notation). Is there solutions to these problems?
thanks
=2D-=20
Lionel Roubeyrie - lro...@li...
LIMAIR
http://www.limair.asso.fr
From: Dave <no...@gm...> - 2007年01月26日 09:45:06
Alan G Isaac <aisaac@...> writes:
> So I installed PyWin32 as above, and PyReadline. I do NOT 
> see IPython in my Start Menu nor when I look at 
> Install/Uninstall programs. I do see an IPython folder in 
> Lib/site-packages, so I guessed I should call Shell.py, but 
> this is either a bad guess or IPython is failing: I briefly
> see a shell labelled IPython flash on screen and disappear.
I installed my version from svn and to get the start menu folders etc. 
I had to run the win32_manual_post_install.py script.
The problem with Ipython immediately closing can be because your default 
home directory isn't writable. To fix this set the environment variable 
HOME (control panel:system - Advanced Tab) to be some directory you have 
write access to e.g. C:\
Also either one or both of the following dlls need to be in your
windows:system32 directory.
mfc71.dll
msvcp71.dll
If you don't have them I believe they can be found on the net.
HTH,
Dave
From: Jonathon A. <and...@gm...> - 2007年01月26日 05:27:44
Could someone point me to documentation of the oo interface? Everything
seems to reference pylab (even examples that say they're for the oo
interface).
~jonathon
1 message has been excluded from this view by a project administrator.

Showing 17 results of 17

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