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


Showing results of 284

<< < 1 2 3 4 .. 12 > >> (Page 2 of 12)
From: Jeff W. <js...@fa...> - 2007年05月29日 20:59:43
James Boyle wrote:
> The code at the end of this message is a toy example which shows the 
> problem I am encountering.
> OS X 10.4.9 basemap 0.9.5 (Numeric 24.2 and Numpy 1.0) python 2.5
>
> I define a map projection using Basemap, and then plot a number of 
> markers at various geographical locations.
> I would like the map coastlines to overlay the marker symbols, that 
> is write over them as they pass through them.
> I cannot get the coastlines to overlay the markers, no matter what 
> the calling sequence. The markers always obscure the coastlines.
>
> In the basemap/example contour_demo.py, the coastlines are called 
> after contourf and the coastlines appear over the filled contours.
> So there seems that there is something different in the plot marker 
> characteristics.
>
> I am probably missing something obvious - but what?
>
>
> --Jim
>
> 
Jim: Using 'zorder=0' when calling the Basemap plot method seems to do 
the trick. Perhaps I should add a 'zorder' keyword to drawcoastlines as 
well (there already is one for fillcontinents).
-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: James B. <bo...@ll...> - 2007年05月29日 20:49:51
The code at the end of this message is a toy example which shows the 
problem I am encountering.
OS X 10.4.9 basemap 0.9.5 (Numeric 24.2 and Numpy 1.0) python 2.5
I define a map projection using Basemap, and then plot a number of 
markers at various geographical locations.
I would like the map coastlines to overlay the marker symbols, that 
is write over them as they pass through them.
I cannot get the coastlines to overlay the markers, no matter what 
the calling sequence. The markers always obscure the coastlines.
In the basemap/example contour_demo.py, the coastlines are called 
after contourf and the coastlines appear over the filled contours.
So there seems that there is something different in the plot marker 
characteristics.
I am probably missing something obvious - but what?
--Jim
import pylab
from matplotlib.toolkits.basemap import Basemap
rawindLocations =[(-12.425,130.891),(-11.3081,131.7651), 
(-12.5858,131.7609),(-11.40891,130.41669),(-13.2287,131.1355), 
(-12.4,129.8)]
keyLat = -12.425
keyLon = 130.891
fig = pylab.figure(figsize = (7,10) )
ax = fig.add_axes([0.1,0.1,0.7,0.7])
m = Basemap(llcrnrlon=keyLon-5.0,llcrnrlat=keyLat-5.0,urcrnrlon=keyLon 
+5.0,urcrnrlat=keyLat 
+5.0,resolution='i',projection='merc',lon_0=130,lat_ts=0.,lat_0=-12.5)
xmap,ymap = m([keyLon],[keyLat])
pts = m.plot(xmap, ymap,'gs')
for p in rawindLocations:
 xmap,ymap = m(p[1],p[0])
 pts = m.plot([xmap], [ymap],'rs',markersize=24)
xmap,ymap = m([keyLon],[keyLat])
pts = m.plot(xmap, ymap,'ch',markersize=36)
m.drawcoastlines()
m.drawcountries()
title = 'example'
ax.set_title(title)
fig.savefig('crap')
fig.clf()
From: Antonino I. <tri...@gm...> - 2007年05月29日 19:43:17
Hi,
2007年5月26日, Steve Schmerler <el...@gm...>:
> Jeff Whitaker wrote:
> > jd...@eo... wrote:
[cut]
> > I get a 600x300 png with that script, using the latest SVN.
> >
> > -Jeff
> >
>
> Me too, on Linux, mpl 0.90dev3131.
Me too with MPL 0.87.7 on Debian Etch.
 ~ Antonio
From: Antonino I. <tri...@gm...> - 2007年05月29日 19:41:23
Hi,
2007年5月24日, Michael Hogue <mic...@ec...>:
> Hi,
>
> I'm wondering how to use matplotlib to
> plot on axes that intersect at the
> origin, as in the following picture:
>
> |
> |
> |
> |
> |(0,0)
> ----------------------------
> |
> |
> |
> |
> |
>
For example with:
 axis((-1,1,-1,1))
 hlines(0,-1,1)
 vlines(0,-1,1)
Regards,
 ~ Antonio
From: rfv-370 <rob...@ya...> - 2007年05月29日 05:50:42
I did reinstall my python with Python 2.5.1, Matplotlib 0.9, wxpython 2.8.4
and then it now works.
Thanx
Best Regards
Robert
rfv-370 wrote:
> 
> I run on WinXP with
> matplotlib 0.9.0
> python 2.4.3 (enthought edition)
> wx.VERSION_STRING = 2.6.3.3
> 
> 
> rfv-370 wrote:
>> 
>> Hello werner,
>> 
>> I tried your small example to use your setup and your simple_plot but i
>> get the following traceback:
>> 
>> Traceback (most recent call last):
>> File "simpletest.py", line 6, in ?
>> File "pylab.pyo", line 1, in ?
>> File "matplotlib\pylab.pyo", line 203, in ?
>> File "matplotlib\axes.pyo", line 16, in ?
>> File "matplotlib\axis.pyo", line 19, in ?
>> File "matplotlib\patches.pyo", line 42, in ?
>> File "matplotlib\patches.pyo", line 79, in Patch
>> File "matplotlib\cbook.pyo", line 352, in dedent
>> AttributeError: 'NoneType' object has no attribute 'splitlines'
>> 
>> Did I miss something?
>> 
>> Actually I am also trying to understand how to py2exe my own app.
>> 
>> Thanx for help.
>> 
>> Best Regards
>> 
>> Robert
>> 
>> Werner F. Bruhin wrote:
>>> 
>>> Hi Giorgio,
>>> 
>>> Had a quick look at pylab based scripts and got an error on 
>>> backend_tkagg when py2exe it. It looks like one needs to force the 
>>> backend to be included, I used tkagg but you would have to replace that 
>>> with wxagg for your script.
>>> 
>>> Attached is a setup.py and from the examples the file simple_plot.py.
>>> 
>>> Werner
>>> 
>>> # -*- coding: iso-8859-1 -*-#
>>> from distutils.core import setup
>>> import os
>>> from os.path import join
>>> import shutil
>>> 
>>> import glob
>>> import py2exe
>>> from py2exe.build_exe import py2exe
>>> import sys
>>> 
>>> import matplotlib
>>> mpdir, mpfiles = matplotlib.get_py2exe_datafiles()
>>> 
>>> # cleanup dist and build directory first (for new py2exe version)
>>> if os.path.exists("dist/prog"):
>>> shutil.rmtree("dist/prog")
>>> 
>>> if os.path.exists("dist/lib"):
>>> shutil.rmtree("dist/lib")
>>> 
>>> if os.path.exists("build"):
>>> shutil.rmtree("build")
>>> 
>>> 
>>> 
>>> #
>>> # A program using wxPython
>>> 
>>> # The manifest will be inserted as resource into the .exe. This
>>> # gives the controls the Windows XP appearance (if run on XP ;-)
>>> #
>>> manifest_template = '''
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>> <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
>>> manifestVersion="1.0">
>>> <assemblyIdentity
>>> version="5.0.0.0"
>>> processorArchitecture="x86"
>>> name="%(prog)s"
>>> type="win32"
>>> />
>>> <description>%(prog)s</description>
>>> <dependency>
>>> <dependentAssembly>
>>> <assemblyIdentity
>>> type="win32"
>>> name="Microsoft.Windows.Common-Controls"
>>> version="6.0.0.0"
>>> processorArchitecture="X86"
>>> publicKeyToken="6595b64144ccf1df"
>>> language="*"
>>> />
>>> </dependentAssembly>
>>> </dependency>
>>> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
>>> <security>
>>> <requestedPrivileges>
>>> <requestedExecutionLevel
>>> level="AsInvoker"
>>> uiAccess="false"/>
>>> </requestedPrivileges>
>>> </security>
>>> </trustInfo>
>>> </assembly>
>>> '''
>>> 
>>> RT_MANIFEST = 32
>>> #
>>> 
>>> # options for py2exe
>>> options = {"py2exe": {"compressed": 1,
>>> "optimize": 2,
>>> "packages": ["encodings",
>>> "pytz.zoneinfo.UTC",
>>> "matplotlib.numerix", "matplotlib.backends.backend_tkagg"
>>> ],
>>> "excludes": ["MySQLdb", ],
>>> "dll_excludes": ["wxmsw26uh_vc.dll"]
>>> }
>>> }
>>> zipfile = r"lib\library.zip"
>>> 
>>> class MetaBase:
>>> def __init__(self, **kw):
>>> self.__dict__.update(kw)
>>> self.version = '1.0'
>>> self.author = "yourname"
>>> self.author_email = "na...@wh..."
>>> self.company_name = ""
>>> self.copyright = "2003 - 2007 by whoever"
>>> self.url = "http://www.whatever.com/"
>>> self.download_url = "http://www.whatever.com/en/"
>>> self.trademark = ""
>>> self.comments = "a comment on the prog"
>>> self.name = "the prog name"
>>> self.description = "a desc on the prog"
>>> 
>>> wx_emb = MetaBase(
>>> script = "simple_plot.py",
>>> other_resources = [(RT_MANIFEST, 1, manifest_template %
>>> dict(prog="your prog name"))],
>>> ## icon_resources = [(1, r"images/some.ico")],
>>> dest_base = r"prog\simple_plot")
>>> 
>>> setup(
>>> classifiers = ["Copyright:: your name",
>>> "Development Status :: 5 Stable",
>>> "Intended Audience :: End User",
>>> "License :: Shareware",
>>> "Operating System :: Microsoft :: Windows 2000",
>>> "Operating System :: Microsoft :: Windows XP",
>>> "Operating System :: Microsoft :: Windows 9x",
>>> "Programming Language :: Python, wxPython",
>>> "Topic :: Home Use"
>>> "Natural Language :: German",
>>> "Natural Language :: French",
>>> "Natural Language :: English"],
>>> windows = [wx_emb],
>>> options = options,
>>> zipfile = zipfile,
>>> data_files = [("lib\\matplotlibdata", mpfiles),
>>> ## matplotlib.get_py2exe_datafiles(), # if you don't
>>> use the lib option
>>> ]
>>> )
>>> #!/usr/bin/env python
>>> """
>>> Example: simple line plot.
>>> Show how to make and save a simple line plot with labels, title and grid
>>> """
>>> from pylab import *
>>> 
>>> t = arange(0.0, 1.0+0.01, 0.01)
>>> s = cos(2*2*pi*t)
>>> plot(t, s)
>>> 
>>> xlabel('time (s)')
>>> ylabel('voltage (mV)')
>>> title('About as simple as it gets, folks')
>>> grid(True)
>>> 
>>> #savefig('simple_plot.png')
>>> savefig('simple_plot')
>>> 
>>> show()
>>> 
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>>> your
>>> opinions on IT & business topics through brief surveys-and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> 
>>> 
>> 
>> 
> 
> 
-- 
View this message in context: http://www.nabble.com/matplotlib-and-py2exe-tf3495922.html#a10848311
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Johann Cohen-T. <co...@sl...> - 2007年05月29日 00:10:35
hello,
the following script correctly plots the 2D exponential, but when I put 
my mouse on it, matplotlib sends this exception on the terminal :
---------------------------------------------------------------------------
exceptions.RuntimeError Traceback (most 
recent call last)
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_qt.py in 
mouseMoveEvent(self, event)
 119 # flipy so y=0 is bottom of canvas
 120 y = self.figure.bbox.height() - event.y()
--> 121 FigureCanvasBase.motion_notify_event( self, x, y )
 122 if DEBUG: print 'mouse move'
 123
/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in 
motion_notify_event(self, x, y, guiEvent)
 952 event = MouseEvent(s, self, x, y, self._button, self._key,
 953 guiEvent=guiEvent)
--> 954 self.callbacks.process(s, event)
 955
 956 def draw(self, *args, **kwargs):
/usr/lib/python2.4/site-packages/matplotlib/cbook.py in process(self, s, 
*args, **kwargs)
 81 self._check_signal(s)
 82 for func in self.callbacks[s].values():
---> 83 func(*args, **kwargs)
 84
 85
/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in 
mouse_move(self, event)
 1246 if event.inaxes and event.inaxes.get_navigate():
 1247
-> 1248 try: s = event.inaxes.format_coord(event.xdata, 
event.ydata) 1249 except ValueError: pass
 1250 except OverflowError: pass
/usr/lib/python2.4/site-packages/matplotlib/axes3d.py in 
format_coord(self, xd, yd)
 375 #lines = [proj3d.line2d(p0,p1) for (p0,p1) in edges]
 376 ldists = [(proj3d.line2d_seg_dist(p0,p1,p),i) for 
i,(p0,p1) in enumerate(edges)]
--> 377 ldists.sort()
 378 # nearest edge
 379 edgei = ldists[0][1]
RuntimeError: An array doesn't make sense as a truth value. Use any(a) 
or all(a).
the script is :
from pylab import *
import numarray as num
import matplotlib.axes3d as p3
x = num.arange(-3.,3.,0.01)
y = num.arange(-3.,3.,0.01)
X, Y = meshgrid(x,y)
Z = exp(-(X**2)-(Y**2))
fig=figure()
ax = p3.Axes3D(fig)
ax.contour3D(X,Y,Z)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
show()
Am I doing something wrong?
thanks,
Johann
From: Werner F. B. <wer...@fr...> - 2007年05月28日 13:04:52
Hi Robert,
If your app is wxPython based then I would use the attached as a test 
case and not the simple_plot one.
Then if you don't use wxPython Unicode 2.6.x then you need to follow 
Andrea's work around.
matplotlib/backends/_wxagg.pyd
to
matplotlib/backends/_wxagg not used.pyd
Hope this helps
Werner
From: Robert V. <rob...@ya...> - 2007年05月28日 11:03:59
Hello Werner, 
 
I run on WinXP with 
matplotlib 0.9.0 
python 2.4.3 (enthought edition) 
wx.VERSION_STRING = 2.6.3.3 
 
 
I tried your small example to use your setup and your simple_plot but i 
get the following traceback: 
 
 Traceback (most recent call last): 
 File "simpletest.py", line 6, in ? 
 File "pylab.pyo", line 1, in ? 
 File "matplotlib\pylab.pyo", line 203, in ? 
 File "matplotlib\axes.pyo", line 16, in ? 
 File "matplotlib\axis.pyo", line 19, in ? 
 File "matplotlib\patches.pyo", line 42, in ? 
 File "matplotlib\patches.pyo", line 79, in Patch 
 File "matplotlib\cbook.pyo", line 352, in dedent 
 AttributeError: 'NoneType' object has no attribute 'splitlines' 
 
 Did I miss something? 
 
 Actually I am also trying to understand how to py2exe my own app. 
 
 Thanx for help. 
 
 Best Regards 
 
 Robert 
 
 Werner F. Bruhin wrote: 
 Hi Giorgio, 
 
 Had a quick look at pylab based scripts and got an error on 
 backend_tkagg when py2exe it. It looks like one needs to force 
the 
 backend to be included, I used tkagg but you would have to 
replace that 
 with wxagg for your script. 
 
 Attached is a setup.py and from the examples the file 
simple_plot.py. 
 
 Werner 
 
 # -*- coding: iso-8859-1 -*-# 
 from distutils.core import setup 
 import os 
 from os.path import join 
 import shutil 
 
 import glob 
 import py2exe 
 from py2exe.build_exe import py2exe 
 import sys 
 
 import matplotlib 
 mpdir, mpfiles = matplotlib.get_py2exe_datafiles() 
 
 # cleanup dist and build directory first (for new py2exe 
version) 
 if os.path.exists("dist/prog"): 
 shutil.rmtree("dist/prog") 
 
 if os.path.exists("dist/lib"): 
 shutil.rmtree("dist/lib") 
 
 if os.path.exists("build"): 
 shutil.rmtree("build") 
 
 
 
 # 
 # A program using wxPython 
 
 # The manifest will be inserted as resource into the .exe. 
This 
 # gives the controls the Windows XP appearance (if run on XP 
;-) 
 # 
 manifest_template = ''' 
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
manifestVersion="1.0"> 
 <assemblyIdentity 
 version="5.0.0.0" 
 processorArchitecture="x86" 
 name="%(prog)s" 
 type="win32" 
 /> 
 <description>%(prog)s</description> 
 <dependency> 
 <dependentAssembly> 
 <assemblyIdentity 
 type="win32" 
 name="Microsoft.Windows.Common-Controls" 
 version="6.0.0.0" 
 processorArchitecture="X86" 
 publicKeyToken="6595b64144ccf1df" 
 language="*" 
 /> 
 </dependentAssembly> 
 </dependency> 
 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 
 <security> 
 <requestedPrivileges> 
 <requestedExecutionLevel 
 level="AsInvoker" 
 uiAccess="false"/> 
 </requestedPrivileges> 
 </security> 
 </trustInfo> 
 </assembly> 
 ''' 
 
 RT_MANIFEST = 32 
 # 
 
 # options for py2exe 
 options = {"py2exe": {"compressed": 1, 
 "optimize": 2, 
 "packages": ["encodings", 
 "pytz.zoneinfo.UTC", 
"matplotlib.numerix", "matplotlib.backends.backend_tkagg" 
 ], 
 "excludes": ["MySQLdb", ], 
 "dll_excludes": ["wxmsw26uh_vc.dll"] 
 } 
 } 
 zipfile = r"lib\library.zip" 
 
 class MetaBase: 
 def __init__(self, **kw): 
 self.__dict__.update(kw) 
 self.version = '1.0' 
 self.author = "yourname" 
 self.author_email = "na...@wh..." 
 self.company_name = "" 
 self.copyright = "2003 - 2007 by whoever" 
 self.url = "http://www.whatever.com/" 
 self.download_url = "http://www.whatever.com/en/" 
 self.trademark = "" 
 self.comments = "a comment on the prog" 
 self.name = "the prog name" 
 self.description = "a desc on the prog" 
 
 wx_emb = MetaBase( 
 script = "simple_plot.py", 
 other_resources = [(RT_MANIFEST, 1, 
manifest_template % dict(prog="your prog name"))], 
 ## icon_resources = [(1, r"images/some.ico")], 
 dest_base = r"prog\simple_plot") 
 
 setup( 
 classifiers = ["Copyright:: your name", 
 "Development Status :: 5 Stable", 
 "Intended Audience :: End User", 
 "License :: Shareware", 
 "Operating System :: Microsoft :: Windows 
2000", 
 "Operating System :: Microsoft :: Windows 
XP", 
 "Operating System :: Microsoft :: Windows 
9x", 
 "Programming Language :: Python, 
wxPython", 
 "Topic :: Home Use" 
 "Natural Language :: German", 
 "Natural Language :: French", 
 "Natural Language :: English"], 
 windows = [wx_emb], 
 options = options, 
 zipfile = zipfile, 
 data_files = [("lib\\matplotlibdata", mpfiles), 
 ## matplotlib.get_py2exe_datafiles(), # if 
you don't use the lib option 
 ] 
 ) 
 #!/usr/bin/env python 
 """ 
 Example: simple line plot. 
 Show how to make and save a simple line plot with labels, title 
and grid 
 """ 
 from pylab import * 
 
 t = arange(0.0, 1.0+0.01, 0.01) 
 s = cos(2*2*pi*t) 
 plot(t, s) 
 
 xlabel('time (s)') 
 ylabel('voltage (mV)') 
 title('About as simple as it gets, folks') 
 grid(True) 
 
 #savefig('simple_plot.png') 
 savefig('simple_plot') 
 
 show() 
 
 
------------------------------------------------------------------------- 
 Take Surveys. Earn Cash. Influence the Future of IT 
 Join SourceForge.net's Techsay panel and you'll get the chance 
to share your 
 opinions on IT & business topics through brief surveys-and earn 
cash 
 
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
 _______________________________________________ 
 Matplotlib-users mailing list 
 Mat...@li... 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
 
 
 
« Return to thread 
Start a free forum or mailing list archive on Nabble 
Werner F. Bruhin wrote: 
> 
> Hi Archana, 
> 
> Archana Ganesan wrote: 
>> Hi all, 
>> 
>> I have a python application that uses matplotlib. I want to compile 
it 
>> into an executable. I tried using py2exe but it returned some error 
>> w.rt matplotlib. Cpuld anyone please help me with this? Is there 
some 
>> other way to get it done? 
> I am using matplotlib (currently 0.90) with wxPython and py2exe 
> (0.6.6). Attached are some sample files. 
> 
> I am on: 
> # Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
> (Intel)] 
> # wxPython 2.8.1.1, Boa Constructor 0.5.2 
> 
> And as I am still using wxPython Ansi I renamed 
> 
> matplotlib/backends/_wxagg.pyd 
> 
> to 
> 
> matplotlib/backends/_wxagg not used.pyd 
> 
> Hope this helps 
> Werner 
> 
> 
> # -*- coding: iso-8859-1 -*-# 
> from distutils.core import setup 
> import os 
> from os.path import join 
> import shutil 
> 
> import glob 
> import py2exe 
> from py2exe.build_exe import py2exe 
> import sys 
> 
> import matplotlib 
> mpdir, mpfiles = matplotlib.get_py2exe_datafiles() 
> 
> # cleanup dist and build directory first (for new py2exe version) 
> if os.path.exists("dist/prog"): 
> shutil.rmtree("dist/prog") 
> 
> if os.path.exists("dist/lib"): 
> shutil.rmtree("dist/lib") 
> 
> if os.path.exists("build"): 
> shutil.rmtree("build") 
> 
> 
> 
> # 
> # A program using wxPython 
> 
> # The manifest will be inserted as resource into the .exe. This 
> # gives the controls the Windows XP appearance (if run on XP ;-) 
> # 
> manifest_template = ''' 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
manifestVersion="1.0"> 
> <assemblyIdentity 
> version="5.0.0.0" 
> processorArchitecture="x86" 
> name="%(prog)s" 
> type="win32" 
> /> 
> <description>%(prog)s</description> 
> <dependency> 
> <dependentAssembly> 
> <assemblyIdentity 
> type="win32" 
> name="Microsoft.Windows.Common-Controls" 
> version="6.0.0.0" 
> processorArchitecture="X86" 
> publicKeyToken="6595b64144ccf1df" 
> language="*" 
> /> 
> </dependentAssembly> 
> </dependency> 
> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 
> <security> 
> <requestedPrivileges> 
> <requestedExecutionLevel 
> level="AsInvoker" 
> uiAccess="false"/> 
> </requestedPrivileges> 
> </security> 
> </trustInfo> 
> </assembly> 
> ''' 
> 
> RT_MANIFEST = 32 
> # 
> 
> # options for py2exe 
> options = {"py2exe": {"compressed": 1, 
> "optimize": 2, 
> "packages": ["encodings", 
> ## "kinterbasdb", 
> "pytz.zoneinfo.UTC", 
> "matplotlib.numerix", 
> ## "email", 
> ## "numpy" 
> ## "PIL", 
> ], 
> "excludes": ["MySQLdb", "Tkconstants", 
"Tkinter", 
> "tcl", 
> "orm.adapters.pgsql", 
> "orm.adapters.mysql" 
> ], 
> "dll_excludes": ["tcl84.dll", "tk84.dll", 
> "wxmsw26uh_vc.dll"] 
> } 
> } 
> zipfile = r"lib\library.zip" 
> 
> class MetaBase: 
> def __init__(self, **kw): 
> self.__dict__.update(kw) 
> self.version = '1.0' 
> self.author = "yourname" 
> self.author_email = "na...@wh..." 
> self.company_name = "" 
> self.copyright = "2003 - 2007 by whoever" 
> self.url = "http://www.whatever.com/" 
> self.download_url = "http://www.whatever.com/en/" 
> self.trademark = "" 
> self.comments = "a comment on the prog" 
> self.name = "the prog name" 
> self.description = "a desc on the prog" 
> 
> wx_emb = MetaBase( 
> script = "embedding_in_wx4.py", 
> other_resources = [(RT_MANIFEST, 1, manifest_template % 
> dict(prog="your prog name"))], 
> ## icon_resources = [(1, r"images/some.ico")], 
> dest_base = r"prog\wx_embed") 
> 
> setup( 
> classifiers = ["Copyright:: your name", 
> "Development Status :: 5 Stable", 
> "Intended Audience :: End User", 
> "License :: Shareware", 
> "Operating System :: Microsoft :: Windows 2000", 
> "Operating System :: Microsoft :: Windows XP", 
> "Operating System :: Microsoft :: Windows 9x", 
> "Programming Language :: Python, wxPython", 
> "Topic :: Home Use" 
> "Natural Language :: German", 
> "Natural Language :: French", 
> "Natural Language :: English"], 
> windows = [wx_emb], 
> #console = [twcb], 
> options = options, 
> zipfile = zipfile, 
> data_files = [("lib\\matplotlibdata", mpfiles), 
> ## matplotlib.get_py2exe_datafiles(), # if you 
don't 
> use the lib option 
> #### ("prog\\amaradata", amaradata), 
> #### ("prog\\amaradata\\Schemata", amaraschemata), 
> #### ("prog\\", python4dll) 
> ] 
> ) 
> 
> #!/usr/bin/env python 
> """ 
> An example of how to use wx or wxagg in an application with a custom 
> toolbar 
> """ 
> 
> from matplotlib.numerix import arange, sin, pi 
> 
> import matplotlib 
> 
> # uncomment the following to use wx rather than wxagg 
> #matplotlib.use('WX') 
> #from matplotlib.backends.backend_wx import FigureCanvasWx as 
FigureCanvas 
> 
> # comment out the following to use wx rather than wxagg 
> matplotlib.use('WXAgg') 
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as 
> FigureCanvas 
> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg 
> 
> from matplotlib.backends.backend_wx import _load_bitmap 
> from matplotlib.figure import Figure 
> from matplotlib.numerix.mlab import rand 
> 
> import wx 
> 
> class MyNavigationToolbar(NavigationToolbar2WxAgg): 
> """ 
> Extend the default wx toolbar with your own event handlers 
> """ 
> ON_CUSTOM = wx.NewId() 
> def __init__(self, canvas, cankill): 
> NavigationToolbar2WxAgg.__init__(self, canvas) 
> 
> # for simplicity I'm going to reuse a bitmap from wx, you'll 
> # probably want to add your own. 
> self.AddSimpleTool(self.ON_CUSTOM, 
_load_bitmap('stock_left.xpm'), 
> 'Click me', 'Activate custom contol') 
> self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) 
> 
> def _on_custom(self, evt): 
> # add some text to the axes in a random location in axes 
(0,1) 
> # coords) with a random color 
> 
> # get the axes 
> ax = self.canvas.figure.axes[0] 
> 
> # generate a random location can color 
> x,y = tuple(rand(2)) 
> rgb = tuple(rand(3)) 
> 
> # add the text and draw 
> ax.text(x, y, 'You clicked me', 
> transform=ax.transAxes, 
> color=rgb) 
> self.canvas.draw() 
> evt.Skip() 
> 
> 
> class CanvasFrame(wx.Frame): 
> 
> def __init__(self): 
> wx.Frame.__init__(self,None,-1, 
> 'CanvasFrame',size=(550,350)) 
> 
> self.SetBackgroundColour(wx.NamedColor("WHITE")) 
> 
> self.figure = Figure(figsize=(5,4), dpi=100) 
> self.axes = self.figure.add_subplot(111) 
> t = arange(0.0,3.0,0.01) 
> s = sin(2*pi*t) 
> 
> self.axes.plot(t,s) 
> 
> self.canvas = FigureCanvas(self, -1, self.figure) 
> 
> self.sizer = wx.BoxSizer(wx.VERTICAL) 
> self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) 
> # Capture the paint message 
> self.Bind(wx.EVT_PAINT, self.OnPaint) 
> 
> self.toolbar = MyNavigationToolbar(self.canvas, True) 
> self.toolbar.Realize() 
> if wx.Platform == '__WXMAC__': 
> # Mac platform (OSX 10.3, MacPython) does not seem to 
cope 
> with 
> # having a toolbar in a sizer. This work-around gets the 
> buttons 
> # back, but at the expense of having the toolbar at the 
top 
> self.SetToolBar(self.toolbar) 
> else: 
> # On Windows platform, default window size is incorrect, 
so 
> set 
> # toolbar width to figure width. 
> tw, th = self.toolbar.GetSizeTuple() 
> fw, fh = self.canvas.GetSizeTuple() 
> # By adding toolbar in sizer, we are able to put it at 
the 
> bottom 
> # of the frame - so appearance is closer to GTK version. 
> # As noted above, doesn't work for Mac. 
> self.toolbar.SetSize(wx.Size(fw, th)) 
> self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) 
> 
> # update the axes menu on the toolbar 
> self.toolbar.update() 
> self.SetSizer(self.sizer) 
> self.Fit() 
> 
> 
> def OnPaint(self, event): 
> self.canvas.draw() 
> event.Skip() 
> 
> class App(wx.App): 
> 
> def OnInit(self): 
> 'Create the main window and insert the custom frame' 
> frame = CanvasFrame() 
> frame.Show(True) 
> 
> return True 
> 
> app = App(0) 
> app.MainLoop() 
> 
> 
> 
------------------------------------------------------------------------- 
> Take Surveys. Earn Cash. Influence the Future of IT 
> Join SourceForge.net's Techsay panel and you'll get the chance to 
share 
> your 
> opinions on IT & business topics through brief surveys-and earn cash 
> 
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
 Werner F. Bruhin wrote:
 Hi Giorgio, 
 
Had a quick look at pylab based scripts and got an error on 
backend_tkagg when py2exe it. It looks like one needs to force the 
backend to be included, I used tkagg but you would have to replace that 
with wxagg for your script. 
 
Attached is a setup.py and from the examples the file simple_plot.py. 
 
Werner 
 
# -*- coding: iso-8859-1 -*-# 
from distutils.core import setup 
import os 
from os.path import join 
import shutil 
 
import glob 
import py2exe 
from py2exe.build_exe import py2exe 
import sys 
 
import matplotlib 
mpdir, mpfiles = matplotlib.get_py2exe_datafiles() 
 
# cleanup dist and build directory first (for new py2exe version) 
if os.path.exists("dist/prog"): 
 shutil.rmtree("dist/prog") 
 
if os.path.exists("dist/lib"): 
 shutil.rmtree("dist/lib") 
 
if os.path.exists("build"): 
 shutil.rmtree("build") 
 
 
 
# 
# A program using wxPython 
 
# The manifest will be inserted as resource into the .exe. This 
# gives the controls the Windows XP appearance (if run on XP ;-) 
# 
manifest_template = ''' 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
<assemblyIdentity 
 version="5.0.0.0" 
 processorArchitecture="x86" 
 name="%(prog)s" 
 type="win32" 
/> 
<description>%(prog)s</description> 
<dependency> 
 <dependentAssembly> 
 <assemblyIdentity 
 type="win32" 
 name="Microsoft.Windows.Common-Controls" 
 version="6.0.0.0" 
 processorArchitecture="X86" 
 publicKeyToken="6595b64144ccf1df" 
 language="*" 
 /> 
 </dependentAssembly> 
</dependency> 
 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 
 <security> 
 <requestedPrivileges> 
 <requestedExecutionLevel 
 level="AsInvoker" 
 uiAccess="false"/> 
 </requestedPrivileges> 
 </security> 
 </trustInfo> 
</assembly> 
''' 
 
RT_MANIFEST = 32 
# 
 
# options for py2exe 
options = {"py2exe": {"compressed": 1, 
 "optimize": 2, 
 "packages": ["encodings", 
 "pytz.zoneinfo.UTC", "matplotlib.numerix", "matplotlib.backends.backend_tkagg" 
 ], 
 "excludes": ["MySQLdb", ], 
 "dll_excludes": ["wxmsw26uh_vc.dll"] 
 } 
 } 
zipfile = r"lib\library.zip" 
 
class MetaBase: 
 def __init__(self, **kw): 
 self.__dict__.update(kw) 
 self.version = '1.0' 
 self.author = "yourname" 
 self.author_email = "na...@wh..." 
 self.company_name = "" 
 self.copyright = "2003 - 2007 by whoever" 
 self.url = "http://www.whatever.com/" 
 self.download_url = "http://www.whatever.com/en/" 
 self.trademark = "" 
 self.comments = "a comment on the prog" 
 self.name = "the prog name" 
 self.description = "a desc on the prog" 
 
wx_emb = MetaBase( 
 script = "simple_plot.py", 
 other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="your prog name"))], 
## icon_resources = [(1, r"images/some.ico")], 
 dest_base = r"prog\simple_plot") 
 
setup( 
 classifiers = ["Copyright:: your name", 
 "Development Status :: 5 Stable", 
 "Intended Audience :: End User", 
 "License :: Shareware", 
 "Operating System :: Microsoft :: Windows 2000", 
 "Operating System :: Microsoft :: Windows XP", 
 "Operating System :: Microsoft :: Windows 9x", 
 "Programming Language :: Python, wxPython", 
 "Topic :: Home Use" 
 "Natural Language :: German", 
 "Natural Language :: French", 
 "Natural Language :: English"], 
 windows = [wx_emb], 
 options = options, 
 zipfile = zipfile, 
 data_files = [("lib\\matplotlibdata", mpfiles), 
## matplotlib.get_py2exe_datafiles(), # if you don't use the lib option 
 ] 
 ) 
#!/usr/bin/env python 
""" 
Example: simple line plot. 
Show how to make and save a simple line plot with labels, title and grid 
""" 
from pylab import * 
 
t = arange(0.0, 1.0+0.01, 0.01) 
s = cos(2*2*pi*t) 
plot(t, s) 
 
xlabel('time (s)') 
ylabel('voltage (mV)') 
title('About as simple as it gets, folks') 
grid(True) 
 
#savefig('simple_plot.png') 
savefig('simple_plot') 
 
show() 
 
------------------------------------------------------------------------- 
Take Surveys. Earn Cash. Influence the Future of IT 
Join SourceForge.net's Techsay panel and you'll get the chance to share your 
opinions on IT & business topics through brief surveys-and earn cash 
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
_______________________________________________ 
Matplotlib-users mailing list 
Mat...@li... 
https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
 
 
 if( self == top ) { Nabble.writeReturnToLink( 'Return to thread' ); } else if( Nabble.prev ) Nabble.writeReturnToLink(Nabble.prev); 
 
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
From: Steve S. <el...@gm...> - 2007年05月26日 19:26:11
Jeff Whitaker wrote:
> jd...@eo... wrote:
>> I'm trying to get matplotlib to make a 600x300 png, but matplotlib won't
>> let me; it keeps making a 612x312 png instead. Here's a sample script
>> that has the problem on my system:
>>
>> figure(figsize=(6., 3.))
>> plot(arange(10))
>> savefig('test.png', dpi=100.)
>>
>> If I set dpi to 50., it makes a 312x162 png. It appears to be adding a 6
>> pixel border to the edge of all the pngs. How do I get rid of it?
>>
>> Windows XP SP2, Python 2.5, matplotlib 0.90.
>>
>> Jordan
>>
>> 
> 
> I get a 600x300 png with that script, using the latest SVN.
> 
> -Jeff
> 
Me too, on Linux, mpl 0.90dev3131. If it's adding a constant border of 6 on two
sides, can you tell mpl to export e.g. 588x288 (more hack than solution, though...)?
-- 
cheers,
steve
I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams
From: Jeff W. <js...@fa...> - 2007年05月26日 13:25:37
jd...@eo... wrote:
> I'm trying to get matplotlib to make a 600x300 png, but matplotlib won't
> let me; it keeps making a 612x312 png instead. Here's a sample script
> that has the problem on my system:
>
> figure(figsize=(6., 3.))
> plot(arange(10))
> savefig('test.png', dpi=100.)
>
> If I set dpi to 50., it makes a 312x162 png. It appears to be adding a 6
> pixel border to the edge of all the pngs. How do I get rid of it?
>
> Windows XP SP2, Python 2.5, matplotlib 0.90.
>
> Jordan
>
> 
I get a 600x300 png with that script, using the latest SVN.
-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: <jd...@eo...> - 2007年05月25日 22:12:15
I'm trying to get matplotlib to make a 600x300 png, but matplotlib won't
let me; it keeps making a 612x312 png instead. Here's a sample script
that has the problem on my system:
figure(figsize=(6., 3.))
plot(arange(10))
savefig('test.png', dpi=100.)
If I set dpi to 50., it makes a 312x162 png. It appears to be adding a 6
pixel border to the edge of all the pngs. How do I get rid of it?
Windows XP SP2, Python 2.5, matplotlib 0.90.
Jordan
From: Christopher B. <Chr...@no...> - 2007年05月25日 15:48:44
Matthias Michler wrote:
> I tried useing matplotlib as a GUI for my programs. I'd like to incorporate 
> things like Buttons, Sliders, RadioButtons and so on from 
> matplotlib.widgets, but missed a prompt (i.e. a field to input text and/or 
> numbers).
I'm going to advise you to not try to do that. MPL really isn't a GUI 
toolkit, there there are a number of very nice and complete GUI toolkits 
that MPL works just great with. It will require a bit of learning up 
front, but you'll get a much better result, and probably less pain in 
the process. My thoughts:
For Cross platform (Windows, *nix, OS-X): wxPython or pyQT. Tk's OK too, 
but at least until recently, not very native or robust on OS-X.
For *nix only: PyGTK
For OS-X only: Maybe pyObjC, but only if MPL is working OK with the 
Cocoa back-end -- or has development stalled there?
See the "embedding in ..." examples, and be sure to check out wxMPL if 
you want to use wxPython.
-Chris
-- 
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: Matthias M. <Mat...@gm...> - 2007年05月25日 10:29:00
Hello everybody,
I tried useing matplotlib as a GUI for my programs. I'd like to incorporate 
things like Buttons, Sliders, RadioButtons and so on from 
matplotlib.widgets, but missed a prompt (i.e. a field to input text and/or 
numbers).
My question is: Is there already a text-input-field in one of the mpl modules?
Best regards and thanks in advance for any hints,
Matthias Michler
From: Jeff W. <js...@fa...> - 2007年05月25日 02:22:49
Teng Yang wrote:
> Jeff,
> This "_r" command seems not work well. Let me show you the full
> line of that color map plot,
> --------------------------------------
> contourf(X, Y, Z, v1, cmap=cm.pink)
> --------------------------------------
Teng:
Have you tried
contourf(X, Y, Z, v1, cmap=cm.pink_r)
-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: Teng Y. <yan...@ms...> - 2007年05月24日 21:55:12
Jeff, 
This "_r" command seems not work well. Let me show you the full
line of that color map plot,
 --------------------------------------
contourf(X, Y, Z, v1, cmap=cm.pink)
 -------------------------------------- 
By the way, Jeff, do you know how to make the cmap explicitly defined,
like in GNUPLOT,
 ----------------------------------------------------------------
set palette defined (0.004 "white", 0.17 "brown", 0.28 "black")
 ---------------------------------------------------------------- 
Thank you so much! 
///Teng 
Jeff Whitaker writes: 
> Teng Yang wrote:
>> Hello, I have a quick question for you. 
>> 
>> I was trying to make a color and contour plot. But the problem is that
>> the matplot defaults the colors from the dark to light for the contour
>> values from minimum to maximum, is there any way or commands to reverse
>> this order? I mean the dark color for maximum value and light color for
>> minimum. 
>> 
>> Thank you so much! 
>> 
>> ///Teng
> 
> Teng: Simply append '_r' to the colormap name to get the colors reversed 
> (e.g. cmap = pylab.cm.hot_r instead of pylab.cm.hot). 
> 
> -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 
> 
> 
 
///Teng 
=======================================
Teng Yang
 ---------
4240 Biomedical &Physical Sci. Bldg
East Lansing, MI 48824-2320 USA 
(517)355-9200 Ext.2239 (office)
(517)282-0791 (mobile)
(517)353-4500 (FAX)
=======================================
 
From: Michael H. <mic...@ec...> - 2007年05月24日 21:12:59
Hi,
I'm wondering how to use matplotlib to 
plot on axes that intersect at the 
origin, as in the following picture:
 |
 |
	 |
 |
 |(0,0)
----------------------------
 | 
 |
 |
 |
 |
Any help will be appreciated
Michael.
From: Jeff W. <js...@fa...> - 2007年05月24日 15:47:30
Teng Yang wrote:
> Hello, I have a quick question for you. 
>
> I was trying to make a color and contour plot. But the problem is that
> the matplot defaults the colors from the dark to light for the contour
> values from minimum to maximum, is there any way or commands to reverse
> this order? I mean the dark color for maximum value and light color for
> minimum. 
>
> Thank you so much! 
>
> ///Teng 
> 
Teng: Simply append '_r' to the colormap name to get the colors 
reversed (e.g. cmap = pylab.cm.hot_r instead of pylab.cm.hot).
-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: Teng Y. <yan...@ms...> - 2007年05月24日 15:11:26
Hello, I have a quick question for you. 
I was trying to make a color and contour plot. But the problem is that
the matplot defaults the colors from the dark to light for the contour
values from minimum to maximum, is there any way or commands to reverse
this order? I mean the dark color for maximum value and light color for
minimum. 
Thank you so much! 
///Teng 
From: Jesper L. <jl...@dm...> - 2007年05月24日 08:31:37
Hi Trevis,
On Wednesday 23 May 2007 17:17, Trevis Crane wrote:
> 1) It's pretty easy to include text on a graph, but are LaTex strings
> supported? That is, I want to write something like this on my plot:
> '\Phi_0 = blah...'. When passing a LaTex command as part of text string
> to be written on a plot in MatLab, it interprets this and displays the
> (in this case) Greek symbol. Any suggestions on how this is or should
> be done with matplotlib?
See the chapter on mathtext on page 32 in the user guide:
http://matplotlib.sourceforge.net/users_guide_0.90.0.pdf
> 2) How do I format how tick mark labels are displayed? I have a plot
> whose x-axis runs from 0 to 8.5e-5. But the tick mark labels are
> 0,0.00001,0.00002,0.00003... This is rather unsightly, but I haven't
> found a way to specify the format of these numbers.
That is described on page 52 in the user guide (see listing 6.1 for an 
example).
Hope this helps.
Cheers,
Jesper
From: Anthony M. F. <Ant...@co...> - 2007年05月24日 00:19:54
Hi All,
I'm trying to respond to double-click events on axis labels and tick
labels. I'm using the wxAgg backend, and matplotlib directly, not
through pylab. The matplotlib panels are wrapped into a bigger program.
Based on an thread between Andrea Gavana and Chris Barker back in Feb
06, I hacked a double-click event into backend_bases.py and
backend_wx.py. This seems to work as expected; I can capture the double
click events without any problem. Now for capturing pick events, the
built-in pick function seems to rely on the selection being "inaxes" so
I borrowed heavily from the object_picker.py demo to capture selecting
the tick labels or the axis labels.
My concern is that I'm reinventing the wheel. Being able to capture
picks of the various labels seems like a natural thing to want to do
(e.g. for modifying font properties, display format, etc). Is there an
easier (erm, and better!) way to accomplish what I've done?
Thanks,
Anthony.
--
Anthony Floyd, PhD
Convergent Manufacturing Technologies Inc.
6190 Agronomy Rd, Suite 403
Vancouver BC V6T 1Z3
CANADA
Email: Ant...@co... | Tel: 604-822-9682
WWW: http://www.convergent.ca | Fax: 604-822-9659 =20
CMT is hiring: See http://www.convergent.ca for details
From: Jeff P. <jef...@ya...> - 2007年05月23日 19:03:52
hello, I'm tinkering with my matplotlibrc file and the changes are not taking effect. specifically I'm changing the hspace and wspace between subplots... although none other options seem to take effect either. I put the matplotlibrc file in my working directory with my script. I also tried making changes to the matplotlirc file in the installation directory, this didn't work either. should pylab be looking in the working directory for matplotlibrc? If so, what might be a reason changes aren't taking effect?
thanks,
Jeff
 
---------------------------------
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.
From: John T W. <joh...@li...> - 2007年05月23日 15:58:59
On 2007年5月23日, Trevis Crane wrote:
> 2) How do I format how tick mark labels are displayed? I have a plot
> whose x-axis runs from 0 to 8.5e-5. But the tick mark labels are
> 0,0.00001,0.00002,0.00003... This is rather unsightly, but I haven't
> found a way to specify the format of these numbers.
Look into the arguments of the xticks function. I do things like
tickvals = arange(5.998,6.0025,0.0005);
ticklabs = map(lambda val:"%.4f"%val, tickvals);
ticklabs[0::2] = map(lambda val:"%.3f"%val, tickvals[0::2]);
xticks(tickvals,ticklabs);
to customize.
 					JTW
From: Darren D. <dd...@co...> - 2007年05月23日 15:51:21
On Wednesday 23 May 2007 11:17:14 am Trevis Crane wrote:
> I have two questions about matplotlib.
>
> 1) It's pretty easy to include text on a graph, but are LaTex strings
> supported? That is, I want to write something like this on my plot:
> '\Phi_0 = blah...'. When passing a LaTex command as part of text string
> to be written on a plot in MatLab, it interprets this and displays the
> (in this case) Greek symbol. Any suggestions on how this is or should
> be done with matplotlib?
matplotlib supports mathtext strings, like r'$\Phi_0 = e^{i\pi}$'. Currently, 
if you want to mix mathmode and regular mode, r'for example: $\Phi_0 = 
e^{i\pi}$', you need to enable usetex in your matplotlibrc file. usetex 
requires latex, ghostscript, dvipng to be properly installed, see 
http://www.scipy.org/Cookbook/Matplotlib/UsingTex for more details.
> 2) How do I format how tick mark labels are displayed? I have a plot
> whose x-axis runs from 0 to 8.5e-5. But the tick mark labels are
> 0,0.00001,0.00002,0.00003... This is rather unsightly, but I haven't
> found a way to specify the format of these numbers.
That's a new problem. Eric, it looks like some of your recent changes to 
ticker.py had some unintended side-effects. Do you have time to look into it?
Darren
From: Trevis C. <t_...@mr...> - 2007年05月23日 15:17:21
Hi, I'm fairly new to using matplotlib having just stopped using Matlab
and started using Python.
=20
I have two questions about matplotlib.
=20
1) It's pretty easy to include text on a graph, but are LaTex strings
supported? That is, I want to write something like this on my plot:
'\Phi_0 =3D blah...'. When passing a LaTex command as part of text =
string
to be written on a plot in MatLab, it interprets this and displays the
(in this case) Greek symbol. Any suggestions on how this is or should
be done with matplotlib?
=20
2) How do I format how tick mark labels are displayed? I have a plot
whose x-axis runs from 0 to 8.5e-5. But the tick mark labels are
0,0.00001,0.00002,0.00003... This is rather unsightly, but I haven't
found a way to specify the format of these numbers. =20
=20
thanks for any help,
trevis
=20
=20
________________________________________________
=20
Trevis Crane
Postdoctoral Research Assoc.
Department of Physics
University of Ilinois
1110 W. Green St.
Urbana, IL 61801
=20
p: 217-244-8652
f: 217-244-2278
e: tc...@ui...
________________________________________________
=20
From: Bernhard V. <ber...@gm...> - 2007年05月22日 11:03:39
>
> Is there any documentation or example presenting similar graphs ?
Take a look at two_scales.py from the examples (
http://matplotlib.sourceforge.net/matplotlib_examples_0.90.0.zip)
Bernhard
6 messages has been excluded from this view by a project administrator.

Showing results of 284

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