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






Showing results of 240

<< < 1 .. 3 4 5 6 7 .. 10 > >> (Page 5 of 10)
From: Emmanuel <emm...@fa...> - 2007年09月19日 20:33:44
With the setup you provided. I could get py2exe to make an exe of the
simple_plot.py from simple_plot_wxagg of py2exe examples.
When I tried this on another python prog, I remarked that if I comment the
following line :
import matplotlib.backends.backend_wxagg
the exe created by py2exe crash and the log tells us :
Traceback (most recent call last):
 File "entropia.py", line 6, in <module>
 File "pylab.pyo", line 1, in <module>
 File "matplotlib\pylab.pyo", line 222, in <module>
 File "matplotlib\backends\__init__.pyo", line 24, in pylab_setup
ImportError: No module named backend_wxagg
I think the same kind of problem may append with the default backend
tkagg...
From: Fabian B. <f.b...@gm...> - 2007年09月19日 19:28:40
Hi Jouni,
Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM:
> Fabian Braennstroem <f.b...@gm...> writes:
> 
>> Lets say I have to columns, the I could use in a script:
>>
>> 	 res=plot(array_mapped[:,0],array_mapped[:,1], 'b',
>> array_mapped[:,0],array_mapped[:,2], 'g')
>>
>> The next time a have 5 columns in a file and want to plot all 5
>> columns without adjusting the 'plot' command in the script, but just
>> by defining an argument when starting the script.
> 
> Perhaps 'plot' is not the ideal interface for your purposes. How about
> something like this:
> 
> 
> 
> ------------------------------------------------------------------------
> 
> #!/usr/bin/env python
> 
> import matplotlib
> from matplotlib.lines import Line2D
> import pylab
> import numpy as npy
> 
> def myplot(ax, matrix, linestyle, color):
> for column in range(1, matrix.shape[1]):
> line = Line2D(matrix[:,0], matrix[:,column],
> linestyle=linestyle, color=color)
> ax.add_line(line)
> 
> colors = 'brk'
> 
> for d in range(2,5):
> fig=pylab.figure()
> ax=fig.add_subplot(111)
> matrix = npy.random.rand(d,d)
> matrix[:,0] = npy.linspace(0, 1, num=d)
> myplot(ax, matrix, '-', colors[d-2])
> 
> pylab.show()
Thanks for your help! add_line seems to be the right
function... I am not sure yet, if I need your function call,
but I will check it!?
Fabian
From: Mika, D. P (G. Research) <mi...@cr...> - 2007年09月19日 18:43:43
How about this solution? I'm a complete newbe, but this seems to do the =
trick. I didn't see a CircleCollection so I used CirclePolygon to =
generate vertices for a circle; these I grab and toss into a =
PolyCollection. Enjoy, Dave
import matplotlib
from matplotlib.patches import CirclePolygon from matplotlib.collections =
import PolyCollection import pylab=20
fig=3Dpylab.figure()
ax=3Dfig.add_subplot(111)=20
N =3D 20
x =3D pylab.rand(N)
y =3D pylab.rand(N)
radii =3D 0.1*pylab.rand(N)
colors =3D 100*pylab.rand(N)
verts =3D []
for x1,y1,r in zip(x, y, radii):
 circle =3D CirclePolygon((x1,y1), r)
 verts.append(circle.get_verts())
 =20
p =3D PolyCollection(verts, cmap=3Dmatplotlib.cm.jet)
p.set_array(pylab.array(colors))
ax.add_patch(p)
pylab.colorbar(p)
ax.axis('equal')
pylab.show()
-----Original Message-----
From: mat...@li... =
[mailto:mat...@li...] On Behalf Of =
Jouni K. Sepp=E4nen
Sent: Wednesday, September 19, 2007 11:03 AM
To: mat...@li...
Subject: Re: [Matplotlib-users] Drawing filled circles (discs)
sidimok <si...@gm...> writes:
> Well, let's take the one you've proposed the last time. How than can i =
> put a colorbar beside the plot?
Add in the imports
from matplotlib.colorbar import ColorbarBase, make_axes
and change the myscatter function to
def myscatter(ax, colormap, x, y, radii, colors):
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
 ax.add_patch(Circle((x1,y1), r, fc=3Dc))
 cax, _ =3D make_axes(ax)
 ColorbarBase(cax, cmap=3Dcolormap)
A better solution is probably to implement a CircleCollection similarly =
to the other collections.
--
Jouni K. Sepp=E4nen
http://www.iki.fi/jks
-------------------------------------------------------------------------=
This SF.net email is sponsored by: Microsoft Defy all challenges. =
Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: <jk...@ik...> - 2007年09月19日 15:06:20
sidimok <si...@gm...> writes:
> Well, let's take the one you've proposed the last time. How than can i put a
> colorbar beside the plot?
Add in the imports
from matplotlib.colorbar import ColorbarBase, make_axes
and change the myscatter function to
def myscatter(ax, colormap, x, y, radii, colors):
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
 ax.add_patch(Circle((x1,y1), r, fc=c))
 cax, _ = make_axes(ax)
 ColorbarBase(cax, cmap=colormap)
A better solution is probably to implement a CircleCollection similarly
to the other collections.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: sidimok <si...@gm...> - 2007年09月19日 13:46:39
Jouni K. Sepp=C3=A4nen wrote:
>=20
>=20
> It would help to give a complete example. ColorbarBase itself does not
> create a colorbar but is useful for drawing a colorbar in existing axes.
>=20
>=20
Well, let's take the one you've proposed the last time. How than can i put =
a
colorbar beside the plot?
#!/usr/bin/env python=20
import matplotlib=20
from matplotlib.patches import Circle=20
import pylab=20
def myscatter(ax, colormap, x, y, radii, colors):=20
 for x1,y1,r,c in zip(x, y, radii, colormap(colors)):=20
 ax.add_patch(Circle((x1,y1), r, fc=3Dc))=20
fig=3Dpylab.figure()=20
ax=3Dfig.add_subplot(111)=20
myscatter(ax, matplotlib.cm.jet,=20
 pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),
pylab.rand(20))=20
ax.axis('equal')=20
pylab.show()
--=20
View this message in context: http://www.nabble.com/Drawing-filled-circles-=
%28discs%29-tf4441651.html#a12777776
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <jk...@ik...> - 2007年09月19日 13:27:46
sidimok <si...@gm...> writes:
> It works just fine, however the colorbar I'm getting with the following
> commands is very tiny.
>
> norm = matplotlib.colors.Normalize(vmin=x[0], vmax=x[-1]) # just an example
> cb = matplotlib.colorbar.ColorbarBase(ax, cmap=matplotlib.cm.jet, norm=norm)
It would help to give a complete example. ColorbarBase itself does not
create a colorbar but is useful for drawing a colorbar in existing axes.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: sidimok <si...@gm...> - 2007年09月19日 12:04:30
Jouni K. Sepp=C3=A4nen wrote:
>=20
> sidimok <si...@gm...> writes:
>=20
>> I'm using matplotlib to draw (from matplotlib.Patches import Circle)
>> filled
>> circles (disks) from a formatted data file, and would give each disk a
>> color relative to a variable, as done by the "scatter" function.
>=20
> Here's one way to do it:
>=20
>=20
> #!/usr/bin/env python
>=20
> import matplotlib
> from matplotlib.patches import Circle
> import pylab
>=20
> def myscatter(ax, colormap, x, y, radii, colors):
> for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
> ax.add_patch(Circle((x1,y1), r, fc=3Dc))
>=20
> fig=3Dpylab.figure()
> ax=3Dfig.add_subplot(111)
>=20
> myscatter(ax, matplotlib.cm.jet,=20
> pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),
> pylab.rand(20))
>=20
> ax.axis('equal')
> pylab.show()
>=20
>=20
>=20
>=20
Hi!
It works just fine, however the colorbar I'm getting with the following
commands is very tiny.
norm =3D matplotlib.colors.Normalize(vmin=3Dx[0], vmax=3Dx[-1]) # just an e=
xample
cb =3D matplotlib.colorbar.ColorbarBase(ax, cmap=3Dmatplotlib.cm.jet, norm=
=3Dnorm)
Any idea?
Thanks guys.
--=20
View this message in context: http://www.nabble.com/Drawing-filled-circles-=
%28discs%29-tf4441651.html#a12776069
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Yo m. H. <miq...@gm...> - 2007年09月19日 08:55:25
Hi all!
I'm actually working with Matplotlib/Pylab Interface for making 2D plot. I
need to specify screen location where the frame will appear and I don't know
how. Supose a simple example like:
from pylab import *
t = arange(0.0,10,0.01)
s = 20*sin(2*pi*t)
c = 20*cos(2*pi*t)
figure(1)
plot(s)
figure(2)
plot(c)
show()
If I do it in this way, one frame is hidded behind the other one. How can I
modify frames attributes in order to change their position on the screen?
Thanks in advance,
Miquel
From: Daniel H. <dp...@gm...> - 2007年09月18日 21:07:20
Hi. I wrote a socket server in python that accepts up to two data 
arrays and should plot them using matplotlib. Unfortunately, when I 
made my server multi-threaded I ran into some very strange issues. I 
can't figure out what exactly is happening so I can't fix it. If anyone 
knows what is going on/why it isn't working, please let me know.
Here is a code snippet (showing what happens when only one data array is 
passed to it):
class pyserv(threading.Thread):
 def __init__(self,(socket,address)):
 threading.Thread.__init__(self)
 self.SOCKET=socket
 self.ADDRESS=address
def run(self):
 
 ...
 (irrelevant code here, receive data from socket, 
byteswap, prepare format string for
 unpacking below, etc.)
 ...
 figure(count)
 dataArray = array(struct.unpack(format,data))
 plot(dataArray)
 show()
 self.SOCKET.close()
count = 1
s = socket(AF_INTER,SOCK_STREAM)
s.bind(appropriate options here)
s.listen(10)
print 'server running'
while True:
 pyserv(s.accept()).start()
 count += 1
Scenario A: When I run this and send one set of data, it plots just 
fine. Subsequent data sets never plot, it opens up a new window as if 
it wants to plot something and then hangs.
Scenario B: When I run this and send one set of data, view it, and then 
close it, I can send another data set. It opens up a figure, plots it, 
and then closes immediately afterwards with no interaction on my part. 
If I put a sleep command after the show(), like sleep(5),it will stay up 
for 5 seconds and then close.
Scenario C: If I plot the data but do not show it until after the while 
loop, I get the same results as in scenario A.
Is it breaking because I can't use multiple show() commands? Does 
matplotlib not play nice with threads or something, or am I just not 
implementing threads correctly (first time w/ python using threads)? 
Data arrays being passed are just character/integer/float arrays. I am 
using an array from numpy to unpack data from the struct. Let me know 
if you need more info. Thanks,
Dan
From: Werner F. B. <wer...@fr...> - 2007年09月18日 20:53:40
Attachments: setup.py
Oops, forgot to copy the list.
Hi Emmanuel,
Emmanuel wrote:
> Hi,
>
> I got the setup.py given by Werner in an old thread (message from 
> april 4th 2007). I putted code thereafter.
This is probably out of date for 0.90.
I attach the one I updated at some point, also I am not sure that how I
deal with the fonts folder is the best/most elegant way but it does the
trick for me. I just tried it out to be sure that it is working with
WinVista, Python 2.5.1 and mp 0.90.1
Hope it helps
Werner
From: Emmanuel <man...@gm...> - 2007年09月18日 20:04:57
Hi,
I got the setup.py given by Werner in an old thread (message from april 4th
2007). I putted code thereafter.
I installed matplotlib 0.90.1/ python 2.5 on windows XP
When I run the setup, it make an exception when using
matplotlib.get_py2exe_datafiles() :
--> 13 mpdir, mpfiles = matplotlib.get_py2exe_datafiles()
C:\Python25\Lib\site-packages\matplotlib\__init__.py in
get_py2exe_datafiles()
 367 mplfiles = glob.glob (os.sep.join([get_data_path(), '*']))
 368 # Need to explicitly remove cocoa_agg files or pyexe complains
 369 mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib']))
 370
The problem is the same with the simple setup.py found on the py2exe
website:
from distutils.core import setup
import py2exe
import sys
#sys.argv.append('py2exe')
import matplotlib
setup(
 console=['simple_plot.py'],
 options={
 'py2exe': {
 'packages' : ['matplotlib', 'pytz'],
 }
 },
 data_files=[matplotlib.get_py2exe_datafiles()]
)
# -*- 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()
From: Daniel F. <dj...@pd...> - 2007年09月18日 19:08:17
Please ignore this question...
 ----- Original Message -----=20
 From: Daniel Fish=20
 To: Mat...@li...=20
 Sent: Tuesday, September 18, 2007 11:21 AM
 Subject: [Matplotlib-users] runtime error
 Could anyone explain why I get a runtime error when using pylab.ion? =
(see below)
 I am running the latest version of matplotlib on Python 2.5 (windows)
 Thanks,
 Daniel Fish
 #-----------Offending code--------
 import pylab
 pylab.ion()
 pylab.plot(range(10))
 #-------------------------------------
 Error Message:
 Runtime Error!=20
 Program: C:\Python25\pythonw.exe
-------------------------------------------------------------------------=
-----
 =
-------------------------------------------------------------------------=
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2005.
 http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------------------------------------------------------------------=
-----
 _______________________________________________
 Matplotlib-users mailing list
 Mat...@li...
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Daniel F. <dj...@pd...> - 2007年09月18日 18:21:08
Could anyone explain why I get a runtime error when using pylab.ion? =
(see below)
I am running the latest version of matplotlib on Python 2.5 (windows)
Thanks,
Daniel Fish
#-----------Offending code--------
import pylab
pylab.ion()
pylab.plot(range(10))
#-------------------------------------
Error Message:
Runtime Error!=20
Program: C:\Python25\pythonw.exe
From: Emmanuel <man...@gm...> - 2007年09月18日 16:43:50
Hi,
I got the setup.py given by Werner in an old thread (message from april 4th
2007). I putted code thereafter.
I installed matplotlib 0.90.1/ python 2.5 on windows XP
When I run the setup, it make an exception when using
matplotlib.get_py2exe_datafiles() :
--> 13 mpdir, mpfiles = matplotlib.get_py2exe_datafiles()
C:\Python25\Lib\site-packages\matplotlib\__init__.py in
get_py2exe_datafiles()
 367 mplfiles = glob.glob(os.sep.join([get_data_path(), '*']))
 368 # Need to explicitly remove cocoa_agg files or pyexe complains
 369 mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib']))
 370
The problem is the same with the simple setup.py found on the py2exe
website:
from distutils.core import setup
import py2exe
import sys
#sys.argv.append('py2exe')
import matplotlib
setup(
 console=['simple_plot.py'],
 options={
 'py2exe': {
 'packages' : ['matplotlib', 'pytz'],
 }
 },
 data_files=[matplotlib.get_py2exe_datafiles()]
)
# -*- 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()
From: yves f. <yve...@gm...> - 2007年09月18日 16:15:54
> lg=legend(...)
> lg.get_frame().set_linewidth(0.1)
>
> > Also, if there is a way of creating the legend without the border at
> > all, I would be happy to hear about it.
>
> Does setting the line width to zero do what you want?
Works like a charm. Thanks!
YVES
From: <jk...@ik...> - 2007年09月18日 15:36:26
"yves frederix" <yve...@gm...>
writes:
> I was wondering if it is possible to change the line width of the
> border around a legend.
Yes, e.g.
lg=legend(...)
lg.get_frame().set_linewidth(0.1)
> Also, if there is a way of creating the legend without the border at
> all, I would be happy to hear about it.
Does setting the line width to zero do what you want?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: yves f. <yve...@gm...> - 2007年09月18日 14:14:44
Hi all,
I was wondering if it is possible to change the line width of the
border around a legend. For a standard sized figure the default value
is ok, but when creating the figures directly at the correct size for
use in a document (=smaller), the lines are too wide. Also, if there
is a way of creating the legend without the border at all, I would be
happy to hear about it.
Many thanks,
YVES
From: Darren D. <dd...@co...> - 2007年09月17日 17:19:46
On Monday 17 September 2007 01:12:46 pm David Montgomery wrote:
> I am trying to save a sample graph I created as a jpeg image. It seems
> form the documentation that the type of image can be determined by the
> extension that is used. Commands seem simple enough.
>
> ind = arange(len(importance_IncNodePurity)) # the x locations for the
> groups width = 0.35 # the width of the bars
> p1 = bar(ind, importance_IncNodePurity, width, color='r')
> ylabel('Importance')
> title('Importance Node Purity')
> xticks(ind+width, importance_row_names)
> psave="c:\eclipse\dafaf.jpg"
> savefig(psave)
> show()
>
>
> However, I seem to get the following errors and I have no idea what they
> mean.
[...]
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 493, in print_figure raise IOError('Do not know know to handle
> extension *%s' % ext)
> IOError: Do not know know to handle extension *.jpg
It means the Agg library, which we use for rendering, does not know how to 
create jpegs. Can you work with png's instead? They are a much better format 
for plots and line art than jpegs.
Darren
From: David M. <dav...@ho...> - 2007年09月17日 17:12:54
Hi,
=20
I am new to matplotlib.
=20
I am trying to save a sample graph I created as a jpeg image. It seems for=
m the documentation that the type of image can be determined by the extensi=
on that is used. Commands seem simple enough.
=20
ind =3D arange(len(importance_IncNodePurity)) # the x locations for the gro=
ups
width =3D 0.35 # the width of the bars
p1 =3D bar(ind, importance_IncNodePurity, width, color=3D'r')
ylabel('Importance')
title('Importance Node Purity')
xticks(ind+width, importance_row_names)
psave=3D"c:\eclipse\dafaf.jpg"
savefig(psave)
show()
=20
=20
However, I seem to get the following errors and I have no idea what they me=
an.
=20
Traceback (most recent call last):
File "C:\Documents and Settings\dmontgomery\workspace\Test\src\create_table=
.py", line 259, in <module>
savefig(psave)
File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 796, in save=
fig
return fig.savefig(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 759, in sav=
efig
self.canvas.print_figure(*args, **kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", =
line 188, in print_figure
**kwargs)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", li=
ne 493, in print_figure
raise IOError('Do not know know to handle extension *%s' % ext)
IOError: Do not know know to handle extension *.jpg
=20
Thanks,
=20
David=
From: Fabian B. <f.b...@gm...> - 2007年09月16日 17:23:42
Hi,
Alan G Isaac schrieb am 09/13/2007 06:15 PM:
> On 2007年9月13日, Fabian Braennstroem apparently wrote:
>> Does nobody have an idea; especially for the 'dynamic'
>> number of plotted arrays!? 
> 
> The question is unclear.
> The problem seems easy enough,
> if you get your hands on the arguments to your script.
> http://homepage.mac.com/andykopra/pdm/tutorials/simplifying_script_arguments.html
Thanks for your help; the question is a bit unclear indeed...
Handling the sys.argv was not the problem; actually my main
problem is to tell the
'plot' or 'loglog' command, that I have a different number
of arrays.
Lets say I have to columns, the I could use in a script:
	 res=plot(array_mapped[:,0],array_mapped[:,1], 'b',
 array_mapped[:,0],array_mapped[:,2], 'g')
The next time a have 5 columns in a file and want to plot
all 5 columns without adjusting the 'plot' command
in the script, but just by defining an argument when
starting the script. I have to adjust somehow dynamically
the plot command to adjust the number of graphs in one
figure; but that is the problem...
Fabian
From: Manu H. <man...@gm...> - 2007年09月16日 04:24:41
import numpy
import pylab
x = y = ybar = numpy.arange(0, 10)
errorbar(x, y, ybar)
errorbar(x, 2 * y, 0.5 * ybar)
legend(["hi" , "hi2"], loc=0)
That gave a AttributeError: LineCollection instance has no attribute
'get_lines'.
I'm running matplotlib on Debian Lenny. Thanks a lot.
From: Ryan K. <rya...@gm...> - 2007年09月15日 15:45:17
I think I was the one who asked a similar question a while back. Here
is a link to John's response:
http://article.gmane.org/gmane.comp.python.matplotlib.general/5465
I followed his advice and created my own formatter:
from matplotlib.ticker import LogFormatterMathtext
class MyFormatter(LogFormatterMathtext):
 def __call__(self, x, pos=3DNone):
 if pos=3D=3D0: return '' # pos=3D0 is the first tick
 else: return LogFormatterMathtext.__call__(self, x, pos)
ax.xaxis.set_major_formatter(MyFormatter())
On 9/14/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:
> James Boyle <bo...@ll...> writes:
>
> > I have not been able to figure out how to just make the first and
> > last ytick labels vanish. [...]
> > I thought that the following might work but this just makes all the
> > labels disappear - my understanding is incomplete.
> > ytl =3D a.get_yticklabels()
> > ytl[0]._visible =3D False
> > ytl[-1]._text =3D False
>
> It is usually a bad idea to manipulate directly anything starting with
> an underscore -- that's a Pythonic way of indicating a "private"
> variable. The set_visible() method should work here:
>
> ytl =3D a.get_yticklabels()
> ytl[0].set_visible(False)
>
> --
> Jouni K. Sepp=E4nen
> http://www.iki.fi/jks
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: sidimok <si...@gm...> - 2007年09月15日 08:25:13
Hi all!
I'm using matplotlib to draw (from matplotlib.Patches import Circle) filled
circles (disks) from a formatted data file, and would give each disk a
color relative to a variable, as done by the "scatter" function.
Any idea how to handle this, please?
Thank's.
-- 
View this message in context: http://www.nabble.com/Drawing-filled-circles-%28discs%29-tf4441651.html#a12672676
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: fatuheeva <fat...@ya...> - 2007年09月14日 18:54:42
Darren Dale <dd...@co...> wrote: On Friday 14 September 2007 02:19:35 pm fatuheeva wrote:
> Hello,
> I can successfully change the facecolor in a figure but when I try and save
> it to a file (jpg or png) the color goes away - the rest of the plot
> remains only the facecolor reverts to white. I have tried using GTK and
> GTKAgg. I have also tried changing the 'savefig' value in the RC file -
> though I'm not sure this is relevant because I'm not using the savefig
> command. So far nothing is working. Any ideas? Thanks,
There is a savefig rc parameter for setting the face color when saving, which 
is probably overriding your changes.
Darren,
Thanks for the quick reply but I have tried changing the savefig parameter in the rc file and it makes no difference.
Mike
 
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 
From: Darren D. <dd...@co...> - 2007年09月14日 18:26:48
On Friday 14 September 2007 02:19:35 pm fatuheeva wrote:
> Hello,
> I can successfully change the facecolor in a figure but when I try and save
> it to a file (jpg or png) the color goes away - the rest of the plot
> remains only the facecolor reverts to white. I have tried using GTK and
> GTKAgg. I have also tried changing the 'savefig' value in the RC file -
> though I'm not sure this is relevant because I'm not using the savefig
> command. So far nothing is working. Any ideas? Thanks,
There is a savefig rc parameter for setting the face color when saving, which 
is probably overriding your changes.
2 messages has been excluded from this view by a project administrator.

Showing results of 240

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