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


Showing 9 results of 9

From: Eric F. <ef...@ha...> - 2006年08月19日 20:37:02
Aaron,
Each text object that you add with the text() function is appended to a 
list called "texts" that is an attribute of the axes object. So, to 
remove the last text object you added, you can do:
del gca().texts[-1]
draw()
If what you want to do is change the contents but not the position, you 
can do:
gca().texts[-1].set_text('Big Mistake')
draw()
If you want to change the position, you can do:
gca().texts[-1].set_position((3,4))
draw()
Note that in the set_position method, unlike the text() function, the 
position is specified as an (x,y) tuple; the parentheses are required.
Or you can just shift one coordinate:
gca().texts[-1].set_x(5)
draw()
If you want to change the first text object, then of course you would 
use texts[0] instead of texts[-1], etc.
There is an alternative pylab function for setting properties that takes 
care of redrawing automatically. Here is an example:
setp(gca().texts[-1], 'fontsize', 15) # Matlab-style
or
setp(gca().texts[-1], fontsize=17) # nicer style
If you are going to want to experiment with the properties of your text 
object, then grab a reference to it when you create it, like this:
tt = text(6,7,'another one')
setp(tt, fontsize=15)
That way you don't have to keep typing "gca().texts[-1]".
Eric
Aaron Hoover wrote:
> Matplotlib is great. Between numpy, scipy, and matplotlib, I'm almost 
> completely weaned myself off of Matlab (just need to rewrite a bunch of 
> m-files in Python).
> 
> My question is, is there an easy way to remove text that's been added 
> with the text() function from a plot (like if I make a mistake in the 
> text or its position)? I've thought about adding a long string of spaces 
> in the same location, but haven't tried it yet. Is there an easier way 
> like a clear() function or some other method I may have missed?
> 
> Thanks,
> Aaron
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Aaron H. <ah...@ee...> - 2006年08月19日 19:36:05
Matplotlib is great. Between numpy, scipy, and matplotlib, I'm almost 
completely weaned myself off of Matlab (just need to rewrite a bunch of 
m-files in Python).
My question is, is there an easy way to remove text that's been added 
with the text() function from a plot (like if I make a mistake in the 
text or its position)? I've thought about adding a long string of spaces 
in the same location, but haven't tried it yet. Is there an easier way 
like a clear() function or some other method I may have missed?
Thanks,
Aaron
From: Darren D. <dd...@co...> - 2006年08月19日 17:27:28
On Saturday 19 August 2006 13:18, Hubert Fitch wrote:
> Hi!
>
> Matplotlib is great! (For some unknown reason Matplotlib did not work until
> I finally bought a differnt Windows XP computer).
> Finally after about a year of trying, I can plot! but when the figure is on
> screen, how can I quickly grab it and save it to a png file?
Just click the save button on the toolbar at the bottom of the window.
From: Hubert F. <pho...@co...> - 2006年08月19日 17:19:07
Attachments: Figure1.png
Hi!
Matplotlib is great! (For some unknown reason Matplotlib did not work until 
I finally bought a differnt Windows XP computer).
Finally after about a year of trying, I can plot! but when the figure is on 
screen, how can I quickly grab it and save it to a png file? Attached is a 
picture of my plot.
This picture was saved using a free screen saver called "Fastone Screen 
Saver." It is really neat! When you start it, a small floating tool bar is 
on screen. Click on the capture rectangle option, and the cross hairs allow 
getting your plotted figure. Now your mouse wheel button allows you to 
enlarge or make the captured figure as small or as large as you like. You 
are given the option to save it to a folder as a .png file.
Incidentaly, I need to be able to find a way to increase the precision of 
Python but only while using an equation (or function?) that calculates gamma 
(g), which is part of the script that generates the lists that are plotted. 
Code below is a small part of the calculation and plotting statements 
required for generating the 42 parameter arrays [lists].
Solve the quadratic, with successive energies as inputs from each kth 
element.
and solve for gamma = g = 1/(1-v**2/LightSpeed**2)**0.5
This is where the greater precision is needed,
when veleocity v is very nearly equal to LightSpeed.
LightSpeed = 299792458.00000000 # Meter/Second
m0 = 9.109389700e-31 # Kilogram Mass Electron
h = 6.62607549351e-034 # h = Q0**2*Z0/(2*a) # Planck's Constant
# SOLVE FOR ALL PARAMETERS
k = 0
while k<541: # Get each kth deBroglie energy
 Ed = Ed_data541[k] # (deBroglie Energy array X-Axis data)
 f = Ed/h
# -----------------------------------------------------------------
 # ----------------# Solve Quadratic (V = v**2)
 A = 1.0 # Quadratic Coefficient A
 B =(h*f/(m0*LightSpeed))**2 # Quadratic Coefficient B
 C = -(h*f/m0)**2 # Quadratic Coefficient C
 V = (-B +(B**2-4*A*C)**0.5)/(2*A)
 v = V**0.5 # Find Velocity from square root of v**2
 b = v/C
 Ev = Ed/Q0 # Electron Volt Energy
 print Ed,k,g,v,C,b,Ev," Ed, k, g, v, LightSpeed, b, Ev"
 if v > LightSpeed:
 break
 if v < C:
 g = 1/(1.0-(v**2/C**2))**0.5 # Gamma
# ---------------------------------------------------------------
# Calculate statements for 42 parameters, and to fill 42 arrays
 k = k+1
# Plot statements
In Python, double precision is already used,
how can a better precision be invoked for this code only?
Can it be done by in-line code or is a function needed?
Hubert Fitch
----- Original Message ----- 
From: "CL" <ane...@gm...>
To: <mat...@li...>
Sent: Thursday, August 17, 2006 2:16 AM
Subject: [Matplotlib-users] copy to graph to clipboard
> Hi,
> When matplotlib is used interactively, eg, with ipython, I find
> that it will be convenient if I can copy the graph into clipboard and
> then paste it to other program. But this feature is missed in current
> release. Is there a plan to add this functionality in a future release?
> If possible, adding a print/preview button will be useful too.
>
> Many thanks for developers' great work.
>
> Chunlei
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
From: Charlie M. <cw...@gm...> - 2006年08月19日 16:51:46
On 8/18/06, assiss <as...@16...> wrote:
> From: "Charlie Moad" <cw...@gm...>
> To: "assiss" <as...@16...>
> Date: 2006年8月18日 20:20:59 +0800 (CST)
> Subject: Re: [Matplotlib-users] python coredump when using GtkAgg mode
>
> Thanks.
>
> 9 import matplotlib._image #worked
> 10 import matplotlib._transforms #worked
> 11
> 12 #one of these three depending on which numerix package you are using
> 13 import matplotlib.backends._na_backend_agg # for
> numarray, worked
> 14 import matplotlib.backends._nc_backend_agg # for
> Numeric, worked
> 15 import matplotlib.backends._ns_backend_agg # for numpy,
> failed, because I didn't install numpy.
> 16
> 17 import matplotlib.backends._tkagg #worked
> 18 import matplotlib._agg #worked
Since your error was with gtk try:
import matplotlib.backends._gtkagg
I am guessing that will fail. You might try reinstalling gtk and
pygtk. I doubt anyone has NetBSD to confirm your error though.
From: Charlie M. <cw...@gm...> - 2006年08月19日 16:47:09
On 8/19/06, Darren Dale <dd...@co...> wrote:
> On Friday 18 August 2006 08:27, Darren Dale wrote:
> > On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote:
> > > Thank you,
> > > Sorry I did known the existence of matplotlib.backends.backend_qt4agg.
> > > It is more easy than I thought.
> > >
> > > but I still have a problem. This is my code :
> > >
> > > import sys
> > >
> > > from PyQt4.QtCore import *
> > > from PyQt4.QtGui import *
> > >
> > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
> > > FigureCanvas
> > > from matplotlib.figure import Figure
> > >
> > > #------------------------------------------------------------------------
> > >-- ---- class MyWidget(QWidget):
> > > def __init__(self, parent=None):
> > > QWidget.__init__(self, parent)
> > > self.menuBar = QMenuBar()
> > > self.fileMenu = QMenu(self.tr("&File"), self)
> > > self.menuBar.addMenu(self.fileMenu)
> > >
> > > mainLayout = QVBoxLayout()
> > > mainLayout.setMenuBar(self.menuBar)
> > >
> > > self.setLayout(mainLayout)
> > >
> > > #------------------------------------------------------------------------
> > >-- ---- if __name__ == "__main__":
> > > app = QApplication(sys.argv)
> > > dialog = MyWidget()
> > > dialog.show()
> > > sys.exit(app.exec_())
> > >
> > > and it does not works because the main window is blocking.
>
> There is a comment in the embedding_in_qt.py example:
>
> # The QApplication has to be created before backend_qt is imported, otherwise
> # it will create one itself.
>
> This goes for qt4 as well, and is the source of the problem. You can have only
> one QApplication at a time. (Ted, John, do you think the QApplication really
> needs to be created during the module import? show() is the only function
> that looks for the QApplication, maybe the qApp should be created there
> instead. Any reason against?)
>
> I added an example, embedding_in_qt4.py, to the svn repository. It is closely
> based on embedding_in_qt.py.
>From what I saw, creating QApp in show makes more sense.
- Charlie
From: Darren D. <dd...@co...> - 2006年08月19日 16:05:07
On Friday 18 August 2006 08:27, Darren Dale wrote:
> On Wednesday 16 August 2006 04:54, Samuel GARCIA wrote:
> > Thank you,
> > Sorry I did known the existence of matplotlib.backends.backend_qt4agg.
> > It is more easy than I thought.
> >
> > but I still have a problem. This is my code :
> >
> > import sys
> >
> > from PyQt4.QtCore import *
> > from PyQt4.QtGui import *
> >
> > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as
> > FigureCanvas
> > from matplotlib.figure import Figure
> >
> > #------------------------------------------------------------------------
> >-- ---- class MyWidget(QWidget):
> > def __init__(self, parent=None):
> > QWidget.__init__(self, parent)
> > self.menuBar = QMenuBar()
> > self.fileMenu = QMenu(self.tr("&File"), self)
> > self.menuBar.addMenu(self.fileMenu)
> >
> > mainLayout = QVBoxLayout()
> > mainLayout.setMenuBar(self.menuBar)
> >
> > self.setLayout(mainLayout)
> >
> > #------------------------------------------------------------------------
> >-- ---- if __name__ == "__main__":
> > app = QApplication(sys.argv)
> > dialog = MyWidget()
> > dialog.show()
> > sys.exit(app.exec_())
> >
> > and it does not works because the main window is blocking.
There is a comment in the embedding_in_qt.py example:
# The QApplication has to be created before backend_qt is imported, otherwise
# it will create one itself.
This goes for qt4 as well, and is the source of the problem. You can have only 
one QApplication at a time. (Ted, John, do you think the QApplication really 
needs to be created during the module import? show() is the only function 
that looks for the QApplication, maybe the qApp should be created there 
instead. Any reason against?)
I added an example, embedding_in_qt4.py, to the svn repository. It is closely 
based on embedding_in_qt.py.
Darren
From: Rudolf S. <rud...@gm...> - 2006年08月19日 11:09:55
Hello,
I tried to embed matplotlib in a GTK2 application (using pygtk & glade) but
encountered a problem.
As I have been playing with it for a while I think that for its
demonstration it is enough to look at the matplotlib example:
embedding_in_gtk2.py (from the example directory of matplotlib)
There, for me the figsize line:
 fig = Figure(figsize=(6,6), dpi=100)
has no effect whatsoever (when tryong to change the size)...
The window size is simply set with
 win.set_default_size(400,300)
and the figure is always of the same size...
Can anybody tell me why?
(In my own application, if I do not explicitely specify a window size, I
always get a window that is too small and has to be resized by hand.)
Currently I am using Windows XP with
 matplotlib 0.87.4
 pygtk 2.8.6
Thank you for any idea!
Ruda
From: "Charlie Moad" <cw...@gm...>
To: "assiss" <as...@16...>
Date: 2006年8月18日 20:20:59 +0800 (CST)
Subject: Re: [Matplotlib-users] python coredump when using GtkAgg mode
Thanks. 
 9 import matplotlib._image #worked
 10 import matplotlib._transforms #worked
 11 
 12 #one of these three depending on which numerix package you are using
 13 import matplotlib.backends._na_backend_agg # for numarray, worked
 14 import matplotlib.backends._nc_backend_agg # for Numeric, worked
 15 import matplotlib.backends._ns_backend_agg # for numpy, failed, because I didn't install numpy.
 16 
 17 import matplotlib.backends._tkagg #worked
 18 import matplotlib._agg #worked
1.py:
######################
from pylab import *
plot(range(3))
show()
######################
Build matplotlib with VERBOSE=True , run python 1.py -dGTKAgg, it showed:
##########################
LazyValue::init_type
Value::init_type
BinOp::init_type
Point::init_type
Interval::init_type
Bbox::init_type
Func::init_type
FuncXY::init_type
Transformation::init_type
SeparableTransformation::init_type
NonseparableTransformation::init_type
Affine::init_type
init_na_transforms
Glyph::init_type
FT2Font::init_type
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
init_na_image
Image::init_type
_transforms_module::new_value
Value::~Value
init_na_backend_agg
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
LazyValue::number
BinOp::BinOp
LazyValue::number
BinOp::BinOp
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_value
_transforms_module::new_value
_transforms_module::new_point
Point::Point
_transforms_module::new_bbox
Bbox::Bbox
_transforms_module::new_func
_transforms_module::new_func
_transforms_module::new_separable_transformation
BBoxTransformation::BBoxTransformation
SeparableTransformation::SeparableTransformation
SeparableTransformation::~SeparableTransformation
Func::~Func
Func::~Func
BBoxTransformation::~BBoxTransformation
Bbox::~Bbox
Point::~Point
Value::~Value
Value::~Value
Point::~Point
Value::~Value
Value::~Value
Bbox::~Bbox
Point::~Point
Value::~Value
Value::~Value
Point::~Point
Value::~Value
Value::~Value
Transformation::~Transformation
Segmentation fault (core dumped)
###########################
> Please follow the segfault instructions and get back to us.
> 
> http://svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/SEGFAULTS?revision=2312&view=markup
> 
> 
> On 8/18/06, assiss <as...@16...> wrote:
> > hi all,
> > I installed matplotlib and it worked very well with TkAgg/Agg. But when use
> > GtkAgg or Gtk, python just coredumped without any prompts.
> > For example, python a.py -dTkAgg, it worked. python a.py -dGtkAgg,
> > "Segmentation fault (core dumped)".
> >
> > When running the examples with -dGtkAgg, gtk_spreadsheet.py
> > embedding_in_gtk.py embedding_in_gtk3.py worked, embedding_in_gtk2.py
> > pylab_with_gtk.py failed and coredumped without any prompts.
> >
> > My system is NetBSD AMD64-3.0. With python 2.4.3, gtk+-2.8.19, pygtk-2.8.6.
> >
> > Is there someting wrong with my system? Thanks for your suggestion.
> >
> > assiss
> > 2006年8月18日
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> >
> 

Showing 9 results of 9

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