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

Showing 16 results of 16

From: massimo s. <mas...@un...> - 2006年06月08日 15:17:58
Attachments: massimo.sandal.vcf
Ok, I guess I found the problem is in my code (the arrays I'm passing 
are indeed empty for some reason, not surprising it can't line fit 
them). So high shame on me for having polluted the mailing list :(
A lesson in humility (and debugging) indeed.
Thanks anyway... I flee in shame.
m.
-- 
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
mas...@un...
tel: +39-051-2094388
fax: +39-051-2094387
From: Christian M. <mee...@un...> - 2006年06月08日 15:16:54
On Thursday 08 June 2006 16:19, massimo sandal wrote:
> Brian Blais ha scritto:
> > I want to write a wxPython script to pull up pylab plots (in a separate
> > window), based on menu or button choices. The script below crashes with
> > a segmentation fault. Am I doing something wrong here? Is there a
> > workaround or fix?
>
> As far as I know, mixing wxpython and pylab this way is BAD.
>
> You should better choose between:
> - (1)Launch pylab in a separate thread
> - (2) (What I do) Using WxMPL and embedding a matplotlib plot in a
> wxPanel or wxFrame. You have to use the OO interface to matplotlib.
>
> m.
Hi,
Agree with massimo. One brief example might help:
import matplotlib
matplotlib.use('WXAgg')
from pylab import gca
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as 
FigureCanvas
from matplotlib.font_manager import fontManager, FontProperties
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import matplotlib.numerix as numpy
from matplotlib.ticker import LogLocator, MultipleLocator
from matplotlib import rcParams
import wx
<snip>
class Your_Class(wx.Frame):
 def __init__(self,parent,id,title):
 wx.Frame.__init__(self,None,-1,"Your_Title")
	<snip>
	
	self.fig = Figure(figsize=(7,5),dpi=100)
 self.axes = self.fig.add_subplot(111)
 self.canvas = FigureCanvas(self, -1, self.fig)
 self.parent = self.canvas.GetParent()
 self.canvas.mpl_connect('motion_notify_event',self.mouse_move)
	<snip: SomeSizer>
	SomeSizer.add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW|wx.EXPAND)
#useful method examples:
 def OnRefresh(self,event=None):
 """
 refreshes the plotting window
 """
 self.canvas.draw()
 self.toolbar.update()
#then the actual drawing function:
 def plot_data(self):
 """
 actual plotting function
 """
 raw_plot(self) #imported own function, see below
 self.toolbar.update() #not necesarry, but might help
def raw_plot(parent):
# note that all meta data / parameters from the parent are accessible !
# e.g. color = parent.color
	parent.fig.clear()
	a = parent.fig.add_subplot(211)
	etc. etc. etc.
Thought this might be helpful to get started. You might want to write things a 
different way, though. Particularly the my application is a bit more than 
just a short script, so feel free to drop anything you don't want.
One last thing: I'd recommend having a look at the matplotlib examples 
('embedding_in_wx*.py').
Cheers,
Christian
From: Darren D. <dd...@co...> - 2006年06月08日 15:15:02
On Thursday 08 June 2006 10:35, massimo sandal wrote:
> Hi,
> I upgraded today to matplotlib 0.87.3, compiled from source.
> I noticed the following error when in my application I try to export the
> plot in EPS format. The odd thing is that the export actually works and
> produces a good eps file, but nevertheless...
>
> File "hooke.py", line 354, in ExportImage #that's my wxpython+MPL app
> self.figure.savefig(filename)
> File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line
> 660, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File
> "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py",
> line 1123, in print_figure
> else: shutil.move(tmpfile, outfile)
> File "/usr/lib/python2.4/shutil.py", line 193, in move
> copy2(src,dst)
> File "/usr/lib/python2.4/shutil.py", line 93, in copy2
> copystat(src, dst)
> File "/usr/lib/python2.4/shutil.py", line 68, in copystat
> os.utime(dst, (st.st_atime, st.st_mtime))
> OSError: [Errno 1] Operation not permitted: 'figura001.eps'
please submit a short script that reproduces the problem.
From: massimo s. <mas...@un...> - 2006年06月08日 15:08:20
Attachments: massimo.sandal.vcf
Hi,
I upgraded today to latest numpy (0.9.8) and matplotlib (0.87.3).
I still have the same error (upgraded code in snippet):
>> ---------
>> import matplotlib.numerix as nx
>>
>> contact_x_points=nx.array(x_points[left_bound:right_bound])
>> contact_y_points=nx.array(y_points[left_bound:right_bound])
>>
>> A=nx.ones((len(contact_x_points),2))
>> A[:,0]=contact_x_points 
>> result=nx.linalg.lstsq(A,contact_y_points)
>> ---------
>>
>> ...but when I run, it crashes with:
>>
 >> result=nx.linalg.lstsq(A, contact_y_points)
 >> File "/usr/lib/python2.4/site-packages/numpy/linalg/linalg.py",
line >> 457, in lstsq
 >> nlvl = max( 0, int( math.log( float(min( m,n ))/2. ) ) + 1 )
 >> OverflowError: math range error
any hint?
m.
-- 
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
mas...@un...
tel: +39-051-2094388
fax: +39-051-2094387
From: Jeff W. <js...@fa...> - 2006年06月08日 15:05:38
The main purpose of this release is to take advantage of the new aspect 
ratio handling in matplotlib 0.87.3.
Some new features have been added (new polar-centric convenience 
projections, sinusoidal projection, ability to plot land-sea masks, 
pcolormesh method), and numerous bugs were squashed.
Here is the full list of changes since 0.8.2:
 * updated for new matplotlib aspect ratio handling.
 Now maps will always have the correct aspect ratio.
 * if resolution keyword is set to None when Basemap
 instance is created, no boundary data sets are needed
 (methods to draw boundaries, like drawcoastlines, will
 raise an exception).
 * update to proj4 module - renamed pyproj to avoid
 conflicts with proj4 module from CDAT.
 * createfigure method deprecated, since maps
 will now automatically have the correct aspect ratio.
 * Added new projections Xpstere, Xplaea, Xpaeqd (where X
 can be n or s). These are special-case, polar-centric
 versions of the stereographic, lambert azimuthal equal area
 and azimuthal equidistant projections that don't require
 you specify the lat/lon values of the lower-left and upper-right
 corners. 
 * fixed bugs in plot, scatter and mapboundary methods for
 miller, cylindrical and mercator projections.
 * 'crude' and 'low' resolution boundary datasets now installed
 by default. basemap_data package now only needed for to get
 'intermediate' and 'high' resolution datasets.
 * moved all packages under single lib/ directory so
 setuptools' "develop" command works properly.
 * Added sinusoidal projection.
 * bilinear interpolation routines can return masked arrays with
 values outside range of data coordinates masked.
 * New examples (warpimage.py - warping an image to
 different map projections, polarmaps.py - simplified polar
 projections, garp.py - 'World According to Garp' maps).
 * pcolormesh method added.
 * drawlsmask method added for masking oceans and/or land areas.
 5 minute land-sea mask dataset added.
-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: massimo s. <mas...@un...> - 2006年06月08日 14:36:10
Attachments: massimo.sandal.vcf
Hi,
I upgraded today to matplotlib 0.87.3, compiled from source.
I noticed the following error when in my application I try to export the 
plot in EPS format. The odd thing is that the export actually works and 
produces a good eps file, but nevertheless...
File "hooke.py", line 354, in ExportImage #that's my wxpython+MPL app
 self.figure.savefig(filename)
 File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line 
660, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File 
"/usr/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py", 
line 1123, in print_figure
 else: shutil.move(tmpfile, outfile)
 File "/usr/lib/python2.4/shutil.py", line 193, in move
 copy2(src,dst)
 File "/usr/lib/python2.4/shutil.py", line 93, in copy2
 copystat(src, dst)
 File "/usr/lib/python2.4/shutil.py", line 68, in copystat
 os.utime(dst, (st.st_atime, st.st_mtime))
OSError: [Errno 1] Operation not permitted: 'figura001.eps'
Thanks as usual!
Massimo
-- 
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
mas...@un...
tel: +39-051-2094388
fax: +39-051-2094387
From: massimo s. <mas...@un...> - 2006年06月08日 14:20:19
Attachments: massimo.sandal.vcf
Brian Blais ha scritto:
> I want to write a wxPython script to pull up pylab plots (in a separate window), 
> based on menu or button choices. The script below crashes with a segmentation fault. 
> Am I doing something wrong here? Is there a workaround or fix?
As far as I know, mixing wxpython and pylab this way is BAD.
You should better choose between:
- (1)Launch pylab in a separate thread
- (2) (What I do) Using WxMPL and embedding a matplotlib plot in a
wxPanel or wxFrame. You have to use the OO interface to matplotlib.
m.
-- 
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
mas...@un...
tel: +39-051-2094388
fax: +39-051-2094387
From: David H. <dav...@gm...> - 2006年06月08日 13:57:20
Hi,
I'd do it the quick way:
str = [...] # list of strings for the labels.
x[:] # abcisse vector
y[i][:] # list of ordinate vector (y[i][:] contains the data for the ith
line)
for i in range(10):
 text(x[-1], y[i][-1], str[i], horizontalalignement='left')
David
2006年6月7日, Webb Sprague <web...@gm...>:
>
> Is there a way to programmatically write line labels, as in the
> attached image? If it doesn't go through the list, basically I want a
> label at the end of each of 10 or so lines in a plot.
>
> Tx
>
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
From: leau2001 <lea...@fr...> - 2006年06月08日 13:32:49
i succed,
just do this :
labels = getp(gca(), 'xticklabels')
setp(labels, 'rotation', 45,'horizontalalignment', 'right', fontsize=8)
that's all ;)
From: Brian B. <bb...@br...> - 2006年06月08日 13:24:56
Hello,
I want to write a wxPython script to pull up pylab plots (in a separate window), 
based on menu or button choices. The script below crashes with a segmentation fault. 
 Am I doing something wrong here? Is there a workaround or fix?
			thanks,
				Brian Blais
#!/usr/bin/env python
from wxPython.wx import *
import pylab
class MyFrame(wxFrame):
 def __init__(self, parent, id, title):
 wxFrame.__init__(self, parent, -1, title)
 self.CenterOnScreen()
 menuBar = wxMenuBar()
 # 1st menu from left
 menu1 = wxMenu()
 menu1.Append(101, "&New")
 menu1.Append(102, "&Close", "Close this frame")
 menuBar.Append(menu1, "&File")
 EVT_MENU(self, 101, self.New)
 EVT_MENU(self, 102, self.Close)
 self.SetMenuBar(menuBar)
 self.Show(True)
 def New(self, event):
 pylab.plot([1,2,3,4],[5,6,7,8])
 pylab.show()
 def CloseWindow(self, event):
 self.Close()
class App(wxApp):
 def OnInit(self):
 frame = MyFrame(None, -1, "testing")
 self.SetTopWindow(frame)
 return True
def main():
 app = App(0)
 app.MainLoop()
if __name__ == "__main__":
 main()
-- 
-----------------
 bb...@br...
 http://web.bryant.edu/~bblais
From: leau2001 <lea...@fr...> - 2006年06月08日 12:01:15
Attachments: x_axis_legend.png
i want to have this x axe look, not with date, but with any words, i 
don't find how i can do this
Thx
From: Darren D. <dd...@co...> - 2006年06月08日 11:53:34
On Wednesday 07 June 2006 16:45, John Hunter wrote:
> >>>>> "William" == William Hartt <wh...@gm...> writes:
>
> William> Does anyone know the syntax for fraction used in
> William> mathtext? The LaTex version is \frac{num}{denom} but
> William> this gives an error.
>
> mathtext doesn't currently support frac (but hopefully it will by the
> end of the summer as we have a google summer-of-code student working
> on mathtext). As Ryan noted, if you have access to TeX/LaTeX on your
> system, you can use that to render your equations
>
> Requirements:
>
> tex
>
> *Agg backends: dvipng
>
> PS backend: latex w/ psfrag, dvips, and Ghostscript 8.51
> (older versions do not work properly)
I think we can relax the ghostscript requirement to version 7.07 or later. I 
worked through some issues a few months back, and my test script (which 
produces three different sized plots for every combination of text.usetex and 
ps.usedistiller settings) didnt indicate any problems using ESP Ghostscript 
7.07. 
Darren
From: Nils W. <nw...@ia...> - 2006年06月08日 11:48:22
Hi all,
Can I use formulas within the legend command, e.g.
legend( ('$\sin(x)$', '$\cos(x)$'), loc='upper left')
Nils
From: leau2001 <lea...@fr...> - 2006年06月08日 08:27:27
No problem with the last version ;)
thx Developpers
From: leau2001 <lea...@fr...> - 2006年06月08日 08:03:54
Iv got an error , when all the value in the list is the same,
" b=points[a+1]-points[a]"=0
then "list_progre"=[0,0,0,0,0,0,0]
and then : "progres=plot(dt_date, list_progre, '')" made me an error : 
"var = dv/max(abs(vmin), abs(vmax)) ZeroDivisionError: float division"
what can i do to stop this error
thx
The program test:
from pylab import *
list_progre=[]
dt_date=[12,13,14,15,16,17,18,19]
points=[25,25,25,25,25,25,25,25]
num_fig=1
nom='test'
chemin_fichier='C:\Python24\uni_33\\'
long_list=len(points)-1
a=0
while a<long_list :
 b=points[a+1]-points[a]
 list_progre.append(b)
 a=a+1
f=figure(num_fig,figsize=(8,6), dpi=72)
subplot(211)
classt=plot(dt_date, points, '')
setp(classt, color='r', linewidth=2.0)
title('Nombre de point au classement general')
xlabel('time')
ylabel('points')
del(dt_date[0])
subplot(212)
progres=plot(dt_date, list_progre, '')
setp(progres, color='g', linewidth=1.0)
title('Progression')
nom_fichier=string.replace(nom,' ','_')
rep_fichier=chemin_fichier+'stat_img\\'
savefig(rep_fichier+nom_fichier, dpi=50)
show()
#f.clf()
From: Webb S. <web...@gm...> - 2006年06月08日 03:55:26
Attachments: fig_w_labels.jpg
Is there a way to programmatically write line labels, as in the
attached image? If it doesn't go through the list, basically I want a
label at the end of each of 10 or so lines in a plot.
Tx

Showing 16 results of 16

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