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



Showing 13 results of 13

From: Gary R. <gr...@bi...> - 2007年10月04日 22:35:55
I'm notice that contourf behaves differently to contour by default in 
where it decides to position contours. For example, using pylab, if you try
a=tri(10)
contourf(a,0)
contour(a,1)
I'd have expected the contours to line up, but they don't. Is there a 
way to get contourf to place its contours at the same position as contour?
thanks,
Gary
From: Robert K. <rob...@gm...> - 2007年10月04日 20:54:34
David D Clark wrote:
> Hi Folks,
> 
> I have an array A=f(x) with a family of curves. Is there an easy way to
> get a different marker for each line of plot(x,A).
Use itertools.cycle() to make an iterator that goes round-and-round. Use
itertools.izip() to match it up with your data, and perhaps a set of colors, too.
import itertools
def marker_cycle():
 """ Return an infinite, cycling iterator over the available marker symbols.
 This is wrapped in a function to make sure that you get a new iterator
 that starts at the beginning every time you request one.
 """
 return itertools.cycle([
 'o','^','v','<','>',
 's','+','x','D','d',
 '1','2','3','4','h',
 'H','p','|','_'])
for kk, m in itertools.izip(range(A.shape[0]), marker_cycle()):
 loglog(f, A[kk], linestyle='-', marker=m, lw=2)
-- 
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: David D C. <dd...@la...> - 2007年10月04日 18:29:12
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Folks,
I have an array A=f(x) with a family of curves. Is there an easy way to
get a different marker for each line of plot(x,A). This is what I
currently have:
mrkrs=array(['o','^','v','<','>',
 's','+','x','D','d',
 '1','2','3','4','h',
 'H','p','|','_'])
ii=0
for kk in arange(A.shape[0]):
 loglog(f,A[kk],
 linestyle='-',
 marker=mrkrs[ii],
 lw=2)
 if ii < mrkrs.size-1:
 ii+=1
 else:
 ii=0
This works, but it's not very elegant.
Thanks,
Dave
- --
David D. Clark
Electrical Engineer
P-23, Neutron Science and Technology
e-mail mailto:dd...@la...
GPG Public key 0x018D6523 available at http://pgp.mit.edu
http://www.gnupg.org has information about public key cryptography
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHBTDkNu7GcwGNZSMRAgFkAJ9wddLwHjGCI805Jb6jokaHjSwGPwCgjwh/
iTbqezvL5vHIv5JGRxAVPyo=
=hOfF
-----END PGP SIGNATURE-----
From: John H. <jd...@gm...> - 2007年10月04日 16:32:04
On 10/1/07, Iacopo <iac...@gm...> wrote:
> Hi everybody,
>
> I tried:
>
> >>> import pylab
> >>> pylab.plot(["a", "b", "c"], [1, 2, 3])
>
> ValueError: invalid literal for float(): a
>
> Well, I expected that. I wrote this to just explain my trouble: printing
> strings instead float along x-axes (a sort of mapping floats to strings...).
> Writing that pylab.plot I mean that "a", "b", "c" were equalli spaced and
> "a" --> 1, "b" --> 2, "c" --> 3. I think it could be a reasonnable command.
> Is there something similar?
pylab.plot([1,2,3], [4,5,6])
pylab.xticks([1,2,3], ['a', 'b', 'c'])
From: Jeff W. <js...@fa...> - 2007年10月04日 14:49:40
Lionel Roubeyrie wrote:
> Hi Jeff,
> I've saw that, but I have the smalls images coordinates in geographic system,
> then I need to recompute their position everytime the user will change the 
> figure's aspect, ... Not very usefull. Is there a way to extend the missing 
> areas around each small image by a "transparent" value, and put this new 
> image layer on the background image? 
Lionel: Not sure what you mean here, but you plot masked arrays with 
imshow, making the missing values transparent (see the image_masked.py 
example). Perhaps you could pad the 'small' image with missing values 
so that it's the same size as the background image, then just plot it 
over the top with basemap.imshow().
> My last chance is to perform the 
> operation directly with PIL, but BTW, I'll lose Basemap projections 
> facilities.
> 
As a last resort you can perform the layering with PIL, the plot the PIL 
image with matplotlib (see image_demo3.py and geos_demo_2.py in the 
basemap examples).
-Jeff
> Le jeudi 04 octobre 2007, Jeff Whitaker a écrit :
> 
>> Lionel: I think you'll need to add other axes to the figure, and then
>> draw the image with axes.imshow.
>>
>> See http://matplotlib.sourceforge.net/screenshots/axes_demo.py for an
>> example of how to use inset axes.
>>
>> -Jeff
>> 
>
>
>
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: John H. <jd...@gm...> - 2007年10月04日 14:32:45
On 10/4/07, Chris <lis...@ma...> wrote:
> Is there a way of forcing them to install? I dont mind going in and
> deleting things by hand myself, but I am trying to have a build that
> installs for almost everyone with minimum tinkering.
Yes, just edit setup.py and remove the conditional checks and simply call
# always add these to the installer
add_pytz()
add_dateutil()
If you need something in the mpl build itself, eg so you can track svn
or future releases, we could probably support an environment variable
or something like it.
JDH
From: Lionel R. <lro...@li...> - 2007年10月04日 13:55:45
Hi Jeff,
I've saw that, but I have the smalls images coordinates in geographic syste=
m,
then I need to recompute their position everytime the user will change the=
=20
figure's aspect, ... Not very usefull. Is there a way to extend the missing=
=20
areas around each small image by a "transparent" value, and put this new=20
image layer on the background image? My last chance is to perform the=20
operation directly with PIL, but BTW, I'll lose Basemap projections=20
facilities.
Le jeudi 04 octobre 2007, Jeff Whitaker a =E9crit=A0:
> Lionel: I think you'll need to add other axes to the figure, and then
> draw the image with axes.imshow.
>
> See http://matplotlib.sourceforge.net/screenshots/axes_demo.py for an
> example of how to use inset axes.
>
> -Jeff
=2D-=20
Lionel Roubeyrie - lro...@li...
Charg=E9 d'=E9tudes et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr
John Hunter <jdh2358@...> writes:
> 
> On 7/17/07, Chris Fonnesbeck <listservs@...> wrote:
> > For some reason, builds from SVN dont install either pytz
> > or dateutil (at least not in the right place). Importing pylab
> > from these builds results in an import error.
> >
> This is typically caused when the install process detects that pytz
> and dateutil are already installed, and so doesn't overright them. My
> guess is that they were available in your PYTHONPATH at install time
> but not at run time. So at install time they are detected and not
> installed, but at run time they cannot be found. If this is the
> solution, you need to build and run in the same environment, or blow
> away existing copies of pytz and dateutil whereever they are lurking
> and then reinstall mpl. Use the __file__ module attr to poke around
> and see if you can find them.
Is there a way of forcing them to install? I dont mind going in and 
deleting things by hand myself, but I am trying to have a build that 
installs for almost everyone with minimum tinkering.
From: Jeff W. <js...@fa...> - 2007年10月04日 11:15:07
Lionel Roubeyrie wrote:
> Hi all,
> I think it's a trivial question, but don't find a solution:
> Drawing an image with imshow (in fact basemap.imshow), I need to put others 
> images on it, but smallers, at specified locations.
> Is there a way to do so, I have tried with extent parameter, but doesn't do 
> what I expect?
> Thanks
> 
Lionel: I think you'll need to add other axes to the figure, and then 
draw the image with axes.imshow.
See http://matplotlib.sourceforge.net/screenshots/axes_demo.py for an 
example of how to use inset axes.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Lionel R. <lro...@li...> - 2007年10月04日 08:43:59
Hi all,
I think it's a trivial question, but don't find a solution:
Drawing an image with imshow (in fact basemap.imshow), I need to put others=
=20
images on it, but smallers, at specified locations.
Is there a way to do so, I have tried with extent parameter, but doesn't do=
=20
what I expect?
Thanks
=2D-=20
Lionel Roubeyrie - lro...@li...
Charg=C3=A9 d'=C3=A9tudes et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr
From: Wayne E. H. <wh...@pa...> - 2007年10月04日 05:50:52
Eric:
First thanks for all the help. Here's the scoop after I replied to your 
earlier post. I thought a bit about the sense of where you were going 
(it always helps to think a bit). So I decided to try compiling 
matplotlib with the GTK backend instead of Tk. I have gtk-2.11.5. So 
I did some sed's to the setup.py file:
sed -i "s|BUILD_GTKAGG = 'auto'|BUILD_GTKAGG = 1|" setup.py &&
sed -i "s|BUILD_GTK = 'auto'|BUILD_GTK = 1|" setup.py &&
sed -i "s|BUILD_TKAGG = 'auto'|BUILD_TKAGG = 0|" setup.py &&
and then proceeded. It turned out that I needed pygtk, so I downloaded 
that and installed it, but pygtk still complained about not having 
pycairo (which it says is optional), so I downloaded that. Making a 
long story short, installing pycairo-1.4.0, pyobject-2.14.0, 
pygtk-2.10.6 and then reinstalling matplotlib with the above sed's did 
the trick. I'm displaying all the plots I have been able to in XP (so I 
don't need XP any more, at least at home).
Once again, thanks for the suggestions. Although I'm set here, I wonder 
about the tcl/tk issue with matplotlib. I am using tcl/tk-8.4.15. I 
wonder if it's too new ? Or is there some other package that is needed ?
Wayne
Eric Firing wrote:
> Wayne,
>
> Segfaults are generally caused by problems in extension code or 
> libraries. The fact that the plotting works with a non-gui backend 
> indicates that the problem is not in matplotlib's transform or Agg 
> extension code, or in the bits of numpy code that get used along the 
> way. I was pretty sure this would be the case; all of those 
> components are solid and well-tested together, at least for simple 
> plotting.
>
> That tends to throw suspicion on Tkinter/Tk/Tcl or one of mpl's 
> extension bits that is run with Tk. I'm not sure there are any in 
> this case.
>
> One way to narrow it down is to try another gui: gtk or qt. Do you 
> have either of these libraries installed?
>
> Eric
>
> Wayne E. Harlan wrote:
>>
>>
>> Eric Firing wrote:
>>> Wayne,
>>>
>>> I'm stumped. Do you get a segfault only with the gui backend? Can 
>>> you you do this:
>>>
>>> import matplotlib
>>> matplotlib.use('Agg')
>>> import pylab
>>> pylab.plot([1,2,3])
>>> pylab.savefig('test.png')
>>>
>>> Eric
>> <previous stuff snipped>
>>
>> OK, this worked. I have attached the test,png file that resulted. 
>> But I don't quite know what this means ...
>>
>> IDLE 1.2.1 >>> import matplotlib
>> >>> matplotlib.use('Agg')
>> >>> import pylab
>> >>> pylab.plot([1,2,3])
>> [<matplotlib.lines.Line2D instance at 0x87cd56c>]
>> >>> pylab.savefig('test.png')
>> >>>
>>
>> The other suggestion from Michael about using gdb will have to wait 
>> until I download, install and learn to use it, but if that's 
>> required, that's what I'll do.
>>
>> Thanks
>>
>> Wayne
>>
>>
>> ------------------------------------------------------------------------
>>
>
>
From: Eric F. <ef...@ha...> - 2007年10月04日 02:53:36
Wayne,
Segfaults are generally caused by problems in extension code or 
libraries. The fact that the plotting works with a non-gui backend 
indicates that the problem is not in matplotlib's transform or Agg 
extension code, or in the bits of numpy code that get used along the 
way. I was pretty sure this would be the case; all of those components 
are solid and well-tested together, at least for simple plotting.
That tends to throw suspicion on Tkinter/Tk/Tcl or one of mpl's 
extension bits that is run with Tk. I'm not sure there are any in this 
case.
One way to narrow it down is to try another gui: gtk or qt. Do you have 
either of these libraries installed?
Eric
Wayne E. Harlan wrote:
> 
> 
> Eric Firing wrote:
>> Wayne,
>>
>> I'm stumped. Do you get a segfault only with the gui backend? Can 
>> you you do this:
>>
>> import matplotlib
>> matplotlib.use('Agg')
>> import pylab
>> pylab.plot([1,2,3])
>> pylab.savefig('test.png')
>>
>> Eric
> <previous stuff snipped>
> 
> OK, this worked. I have attached the test,png file that resulted. But 
> I don't quite know what this means ...
> 
> IDLE 1.2.1 >>> import matplotlib
> >>> matplotlib.use('Agg')
> >>> import pylab
> >>> pylab.plot([1,2,3])
> [<matplotlib.lines.Line2D instance at 0x87cd56c>]
> >>> pylab.savefig('test.png')
> >>>
> 
> The other suggestion from Michael about using gdb will have to wait 
> until I download, install and learn to use it, but if that's required, 
> that's what I'll do.
> 
> Thanks
> 
> Wayne
> 
> 
> ------------------------------------------------------------------------
> 
From: Wayne E. H. <wh...@pa...> - 2007年10月04日 02:26:25
Attachments: test.png
Eric Firing wrote:
> Wayne,
>
> I'm stumped. Do you get a segfault only with the gui backend? Can 
> you you do this:
>
> import matplotlib
> matplotlib.use('Agg')
> import pylab
> pylab.plot([1,2,3])
> pylab.savefig('test.png')
>
> Eric
<previous stuff snipped>
OK, this worked. I have attached the test,png file that resulted. But 
I don't quite know what this means ...
IDLE 1.2.1 
 >>> import matplotlib
 >>> matplotlib.use('Agg')
 >>> import pylab
 >>> pylab.plot([1,2,3])
[<matplotlib.lines.Line2D instance at 0x87cd56c>]
 >>> pylab.savefig('test.png')
 >>>
The other suggestion from Michael about using gdb will have to wait 
until I download, install and learn to use it, but if that's required, 
that's what I'll do.
Thanks
Wayne

Showing 13 results of 13

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