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






Showing results of 33

1 2 > >> (Page 1 of 2)
From: Jae-Joon L. <lee...@gm...> - 2010年02月08日 23:36:18
This is not a bug.
The exception is raised simply because "textartist.figure" is None
(and it is None because you never set it).
"textartist" you created is not properly set up (no figure, no axes,
no transform). You may do
textartist = Text(0.5, 0.5, "Foo")
textartist.set_figure(fig)
fig.draw_artist(textartist)
fig.canvas.blit(fig.bbox)
But, this is not the recommended way of doing things.
draw_artist is mainly for doing animation.
http://matplotlib.sourceforge.net/examples/animation/index.html
Regards,
-JJ
On Mon, Feb 8, 2010 at 4:24 PM, Ben Axelrod <BAx...@co...> wrote:
> I am getting a fault when I try to use Figure.draw_artist() with a matplotlib.text.Text object. Since matplotlib.text.Text inherits from matplotlib.artist.Artist, which is what draw_artist() takes, this should probably work.
>
> Tested with latest SVN code on Linux.
>
> Here is the traceback:
>
> Traceback (most recent call last):
> File "test.py", line 10, in <module>
>  fig.draw_artist(textartist)
> File "/usr/local/lib/python2.6/site-packages/matplotlib/figure.py", line 816, in draw_artist
>  a.draw(self._cachedRenderer)
> File "/usr/local/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
>  draw(artist, renderer, *kl)
> File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 549, in draw
>  bbox, info = self._get_layout(renderer)
> File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 267, in _get_layout
>  key = self.get_prop_tup()
> File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 716, in get_prop_tup
>  self.figure.dpi, id(self._renderer),
> AttributeError: 'NoneType' object has no attribute 'dpi'
>
> And here is some simple code to trigger the bug:
>
> #!/usr/bin/env python
> # display bug in figure.draw_artist(matplotlib.text)
> import matplotlib.pyplot as plt
> from matplotlib.text import Text
>
> fig = plt.figure()
> plt.draw()
>
> textartist = Text(0.5, 0.5, "Foo")
> fig.draw_artist(textartist)
>
> plt.show()
> #end code
>
> Note that I still get the bug even when i specify figsize and dpi on the figure like so:
> fig = plt.figure(figsize=(2,2), dpi=300)
>
> -Ben
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: <PH...@Ge...> - 2010年02月08日 21:41:56
Ted,
How does this example run for you?
http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html
From: Ted Kord [mailto:ted...@go...]
Sent: Monday, February 08, 2010 12:00 PM
To: Paul Hobson
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Surface Plot
On 8 February 2010 17:37, <PH...@ge...<mailto:PH...@ge...>> wrote:
Hey Ted,
I don't quite understand how you're getting the Z data below. But if you have 3D data in X, Y, and Z 1D-arrays, the griddata function should work for you.
http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata
HTH,
-paul
Hi Paul
Is there a way to colour the output? For some reason, the final output is in a single colour even though I've specified cm.jet for the colour map.
Regards
Ted
From: Ben A. <BAx...@co...> - 2010年02月08日 21:24:55
I am getting a fault when I try to use Figure.draw_artist() with a matplotlib.text.Text object. Since matplotlib.text.Text inherits from matplotlib.artist.Artist, which is what draw_artist() takes, this should probably work.
Tested with latest SVN code on Linux.
Here is the traceback:
Traceback (most recent call last):
 File "test.py", line 10, in <module>
 fig.draw_artist(textartist)
 File "/usr/local/lib/python2.6/site-packages/matplotlib/figure.py", line 816, in draw_artist
 a.draw(self._cachedRenderer)
 File "/usr/local/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
 draw(artist, renderer, *kl)
 File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 549, in draw
 bbox, info = self._get_layout(renderer)
 File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 267, in _get_layout
 key = self.get_prop_tup()
 File "/usr/local/lib/python2.6/site-packages/matplotlib/text.py", line 716, in get_prop_tup
 self.figure.dpi, id(self._renderer),
AttributeError: 'NoneType' object has no attribute 'dpi'
And here is some simple code to trigger the bug:
#!/usr/bin/env python
# display bug in figure.draw_artist(matplotlib.text)
import matplotlib.pyplot as plt
from matplotlib.text import Text
fig = plt.figure()
plt.draw()
textartist = Text(0.5, 0.5, "Foo")
fig.draw_artist(textartist)
plt.show()
#end code
Note that I still get the bug even when i specify figsize and dpi on the figure like so:
fig = plt.figure(figsize=(2,2), dpi=300)
-Ben
From: Tomasz K. <t.k...@ci...> - 2010年02月08日 20:50:39
Dear Users/Developers
I just installed version 0.99.1.1 since in my previous version (0.98) 
I had problems with hatching. It seems though that the same problems 
persist in the current version. The attached files reproduce the 
problem (a data file and a python short script). Note that hatching is 
not present on all green 'CONUPD' fields - but only on few of them.
I will appreciate some hints on how to get by,
Regards
Tomek
===================
From: Christopher B. <Chr...@no...> - 2010年02月08日 20:49:22
Adolfo Aguirre wrote:
> He ́s answer was that Zope awas not an straightforward stable 
> environment but a work-in-progress,
Zope has been around a long time, it' s fine environment, particularly 
when used as the core of Plone. Zope does have its own way of doing 
things that are not to everyone's taste. If your admin folks don't like 
it, there are MANY other ways to build a web app with Python.
MPL should work with any Python web application framework that allows 
arbitrary python packages, which is probably every one.
I'd take a look at Django, Pylons and Turbogears, at least.
 > and that he did not find a single
> straight way to put matyplotlib online.
He was not looking very hard.
On the other had, if you have a well established set of web services 
built on PHP, they may not want to build something new, but I'll bet you 
could still use MPL to do your plotting by calling Python as a separate 
process. You could even get fancy and build a web service that does the 
plotting, and have your web apps call that (Pylons would be good for 
that, it's very flexible)
> in case we are missing something.
I think you are -- MPL is a fine choice for putting plots on the web. 
PHPlot may be also -- I know nothing of it.
HTH,
-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: <Dav...@se...> - 2010年02月08日 20:29:32
Hey folks,
my problem may be obvious, but i can't seem to copy a plot from one canvas
to another.
# I have this object where whichCanvas is an instance of MplWidget (code
shown below)
 self.whichCanvas.canvas.ax.plot(xData, yData, 'bo', linewidth=1.5,
linestyle='-')
# I want to copy the plot and axes to another MplWidget object
 self.anotherCanvas.canvas
I've tried:
self.anotherCanvas.canvas.ax = self.whichCanvas.canvas.ax
self.anotherCanvas.canvas.draw()
and
self.anotherCanvas.canvas = self.whichCanvas.canvas
self.anotherCanvas.canvas.draw()
the plot doesn't seem to copy. Does any body more familiar with matplotlib
have any suggestions?
This is the MplWidget Class
***************************** MplWidget *******************************
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg \
 import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
class MplCanvas(FigureCanvas):
 def __init__(self):
 self.fig = Figure()
 self.ax = self.fig.add_subplot(111)
 FigureCanvas.__init__(self, self.fig)
 FigureCanvas.setSizePolicy(self,
 QtGui.QSizePolicy.Expanding,
 QtGui.QSizePolicy.Expanding)
 FigureCanvas.updateGeometry(self)
class MplWidget(QtGui.QWidget):
 def __init__(self, parent = None):
 QtGui.QWidget.__init__(self, parent)
 self.canvas = MplCanvas()
 self.vbl = QtGui.QVBoxLayout()
 self.vbl.addWidget(self.canvas)
 self.setLayout(self.vbl)
Regards,
Dave Tung
cell: 925-321-6657
office: 510-353-4770
dav...@se...
From: Ted K. <ted...@go...> - 2010年02月08日 20:00:14
On 8 February 2010 17:37, <PH...@ge...> wrote:
> Hey Ted,
>
> I don't quite understand how you're getting the Z data below. But if you
> have 3D data in X, Y, and Z 1D-arrays, the griddata function should work for
> you.
>
> http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata
>
> HTH,
> -paul
>
>
Hi Paul
Is there a way to colour the output? For some reason, the final output is in
a single colour even though I've specified cm.jet for the colour map.
Regards
Ted
From: C M <cmp...@gm...> - 2010年02月08日 19:49:58
I'd like to set the ticks on the y axis such that they do not display
anything lower than 0, even if part of the graph below 0 is visible.
I tried to do this with
ylocator = AutoLocator()
ylocator.view_limits(0, 100)
self.subplot.yaxis.set_major_locator(ylocator)
but it is not changing anything. How can I do this?
Thank you,
Che
From: Art <gre...@gm...> - 2010年02月08日 19:06:23
On Mac OS X 10.6.2, with Sage 4.3.1, I have installed matplotlib-0.99.1 with
gui backend (to do this, I set SAGE_MATPLOTLIB_GUI=True before using sage's
spkg installer, which performs some patches on matplotlib that ).
When I use the OS X backend and do:
import matplotlib.pyplot as plt
plt.figure()
plt.plot([1,2,3,4])
I get a plot that has as evenly spaced x-labels [0.,0.,1.,1.,2.,2.,3.] and
y-labels [1.,1.,2.,2.,3.,3.,4.].
If I try,
plt.plot([10, 20, 30, 40])
I get y-labels [1,1,2,2,3,3,4]. It seems there is an issue with rendering
the last digit for the labels.
If I use the TkAgg backend, the axes are labeled correctly.
However, on the same machine, with EPD 6.0 installed and Mac OX backend, the
labels are correct.
Any tips, even temorary workaround would be appreciated. I primarily use
sage, but in the default build, it doesn't include a gui backend. Wanted to
check here before I ask the sage users list.
Art.
From: Sean A. <les...@gm...> - 2010年02月08日 18:41:57
Greetings Adolfo,
On Mon, Feb 8, 2010 at 12:18 PM, Adolfo Aguirre
<agu...@gm...> wrote:
> Hi:
>
> I do environmental research that requires almost real time online graphing
> for data originating in the field.
Can you be a little more specific regarding 'almost real time?' I
update data from a remote meteorological research sites. Data streams
to the computer every minute and is dumped to plain ascii files. I
use pyinotify to watch for the new files to arrive, then execute my
analysis/plotting routines which produce plots; The plots are then
pushed to our webserver.
Sean
> I am a fan of Phyton thus I commissioned
> a systems administrator to figure out how to put Matplotlib online. He ́s
> answer was that Zope awas not an straightforward stable environment but a
> work-in-progress, and that he did not find a single straight way to put
> matyplotlib online. He suggested PHPlot.
>
> I like the plotting I do with Mathplotlib on my computer thus I wanted to
> ask matplotlib users about it, in case we are missing something.
>
> Appreciating your help,
>
> Adolfo
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: James C. <clo...@jh...> - 2010年02月08日 18:25:56
>>>>> "M" == Michael Droettboom <md...@st...> writes:
M> Matplotlib will output Type 42 fonts if the rcParam "ps.fonttype"
M> is set to 42.
I read the reply which stated that after sending mine....
Sorry for the noise.
-JimC
-- 
James Cloos <cl...@jh...> OpenPGP: 1024D/ED7DAEA6
From: Ted K. <ted...@go...> - 2010年02月08日 18:21:15
Hi Paul
This helped immensely. Thanks.
Ted
From: Adolfo A. <agu...@gm...> - 2010年02月08日 18:18:50
Hi:
I do environmental research that requires almost real time online graphing
for data originating in the field. I am a fan of Phyton thus I commissioned
a systems administrator to figure out how to put Matplotlib online. He ́s
answer was that Zope awas not an straightforward stable environment but a
work-in-progress, and that he did not find a single straight way to put
matyplotlib online. He suggested PHPlot.
I like the plotting I do with Mathplotlib on my computer thus I wanted to
ask matplotlib users about it, in case we are missing something.
Appreciating your help,
Adolfo
From: <PH...@Ge...> - 2010年02月08日 17:37:21
Hey Ted,
I don't quite understand how you're getting the Z data below. But if you have 3D data in X, Y, and Z 1D-arrays, the griddata function should work for you. 
http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata
HTH, 
-paul
-------------------------------------
From: Ted Kord [mailto:ted...@go...] 
Sent: Saturday, February 06, 2010 1:05 PM
To: mat...@li...
Subject: [Matplotlib-users] Surface Plot
Hi
I'd like to generate a surface plot using mplot3d. However, Z is not a function of X and/or Y. It's just a set of scalar values. So, the following doesn't work:
X = np.arange(2, 102, 2)
Y = np.arange(0, 15.15, 0.15)
X, Y = np.meshgrid(X, Y)
Z = f[2]
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) 
Is there a way that I can do this?
Thank you.
Ted
From: Wayne W. <sie...@sb...> - 2010年02月08日 16:55:08
Thanks. That could be a very useful observation. I'm doing most of this 
on a win7 machine. When I installed MPL, I had two small dialogs appear 
that said something was missing, but I pressed on. MPL seemed to 
generally work except for the show() problem. I'm in the process of 
bringing programs from my XP to the win7 machine, and on the XP machine 
I decided to start using MPL with a 900 line Py program that I'm 
revising. I had gotten stuck with the very same problem there. However, 
last night I realized someone had added a MPL plot to it years ago, and 
it does not fail on show().
I noticed the msgs mentioned, and though I mad made a mistake in not 
installing numpy first, so tried to figure out a way to do it. Three 
posts on different forums did not provide an answer. I accidentally 
founnd the author of MPL's hidden away in one of MPL files. He said it 
didn't make a difference and asked me not to use his address. I though 
the warning msgs might be of interest to him, so wrote to him. He had 
blocked me. Perhaps I need to file a bug report to get his attention on 
that.
Anyway, I'm now stalled on the development of the big program. It's 
possible this is an IDLE problem, but I ran the big program with a click 
on the file, and the black window showed the same problem. It did show 
some other warnings, which I think I'll capture with Snagit. This is all 
on XP Pro.
I'm going to copy the two code segments here. Maybe you can see a 
difference. I'll also attach the capture of the window too. Two jpg 
files are attached for the same code below, and one for the error 
messages from the console XP.
=================OLD working code============
 def light_curve( self ):
 result = []
 test = 1
 for tup in self.subimages:
 left,top,subimage = tup
 total = 0
 avg_total = 0
 if (test == 1):
 box = (left, top, left+128, top+128)
 region = self.reference_image.crop(box)
 self.reference_image.paste(subimage, box)
 test = 2
 else:
 for x in range(left+43,left+82):
 for y in range(top+43, top+82):
 avg_total = avg_total + 
self.reference_image.getpixel((x, y))
 for x in range(43,82): #take the center 40 X 40 pixel block
 for y in range(43,82):
 v = subimage.getpixel((x, y))
 total = total + v
 #for x in range(left, left+127):
 # for y in range(top, top+127):
 # avg_total = avg_total + 
self.reference_image.getpixel((x, y))
 #for x in range(0, 127):
 # for y in range(0, 127):
 # total = total + subimage.getpixel((x, y))
 result.append(total - avg_total) #(average - background 
average) gives pixel intensity above the background)
 plotting_x = range(2, len(result)+2)
 plot(plotting_x, result)
 xlabel('Frame #')
 ylabel('Pixel count above background count')
 title('Light curve for selected subplot')
 show()
===========New Code with show problem
 def get_point_trail_stats(self): # Simple track statistics
 xy = array(self.xya)[:,0:2] # creates a two column array for x,y
 pt2pt_dist = []
 pt_dist = []
 for k in arange(0,len(xy)-1):
 distance = sqrt((xy[k+1,0]-xy[k,0])**2 + 
(xy[k+1,1]-xy[k,1])**2)
 pt_dist.append(distance)
 # wtw print "k ",k, (xy[k,0], xy[k,1]), " distance: ", distance
 # wtwfor k in arange(0, len(xy)-50):
 # wtw print "k: %3i dist: %6.2f (x,y) (%4.1f,%4.1f)" % (k, 
pt_dist[k], xy[k,0], xy[k,1])
 per_tile25 = stats.scoreatpercentile(pt_dist,25.0)
 per_tile50 = stats.scoreatpercentile(pt_dist,50.0)
 per_tile75 = stats.scoreatpercentile(pt_dist,75.0)
 mean = stats.mean(pt_dist)
 std = stats.std(pt_dist)
 #sys.exit()
 amin = min(pt_dist)
 amax = max(pt_dist)
 print " mean: %7.2f std: %7.2f min: %7.2f max: %7.2f" % 
(mean, std, amin, amax)
 print " quartiles (25-per: %7.2f, 50-per: %7.2f, 75-per: 
%7.2f): " % (per_tile25, per_tile50, per_tile75)
 #print " Extended stats"
 #print " min: %7.2f max: %7.2f mean: %7.2f std: %7.2f" % \
 # (min, max, mean, std)
 #print " p25: %7.2f p50: %7.2f p75: %7.2f" % (per_tile25, 
per_tile50, per_tile75)
 trk_stats = (amin, amax, mean, std, per_tile25, per_tile50, 
per_tile75)
 fig = figure()
 ax1 = fig.add_subplot(111)
 v = (0, 640, 0, 480)
 print "shapes: ", xy[:,0].shape, xy[:,1].shape
 fig.close()
 ax1.plot(xy[:,0], xy[:,1]) #,100*s, c , picker=True)
 ax1.axis(v)
 #x = (0,1,3,20,20);y=(5,7, 9, 22,90)
 #col = ax1.plot(x,y)
 show()
 print "something for wtw plot"
 print
 return trk_stats
On 2/7/2010 10:53 PM, Philipp Bender wrote:
> I'm pretty sure your problem is not generally related to matplotlib, all the
> examples you mentioned and the one you sent me by e-mail worked for me. Maybe
> you try a different version or a different operating system for your scripts.
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion). -- WTW
From: Michael D. <md...@st...> - 2010年02月08日 16:22:47
Matplotlib will output Type 42 fonts if the rcParam "ps.fonttype" is set to 42. Type 3 is the default because it greatly reduces filesize (it embeds only a subset of the font), particularly with large Unicode fonts like Vera Sans.
Mike
From: Michael D. <md...@st...> - 2010年02月08日 16:14:56
Have you tried explicitly calling .clf() on the matplotlib Figure object from your Tix.Frame.destroy callback?
Mike
From: Ben A. <BAx...@co...> - 2010年02月08日 16:05:10
One more note about Axes3D and mouse rotation. Axes3D disconnects the mouse callbacks when cla() is called. Which means that if you do this:
self.axes = Axes3D(self.figure)
self.axes.scatter(xs, ys, zs)
self.axes.cla()
self.axes.scatter(xs, ys, zs)
then the plot will have no mouse rotation. To fix this, mouse_init() should be called after cla(). Currently, all of this is undocumented. Is disconnecting mouse callbacks on cla() the preferred matplotlib way to do things? Is it safe to *not* disconnect mouse callbacks on cla()? Maybe there is another type of destructor that is more appropriate for this?
Thanks,
-Ben
-----Original Message-----
From: Ben Axelrod [mailto:BAx...@co...] 
Sent: Saturday, February 06, 2010 5:55 PM
To: mat...@li...
Subject: Re: [Matplotlib-users] Axes3D rotation not working when embedded in backend
I looked into this issue a little bit and found that the FigureCanvas must be set on the Figure before the 3D axes is instantiated. A simple re-ordering of the lines in the code below makes mouse rotation work again.
# ...
self.figure = Figure()
self.canvas = FigureCanvas(self, -1, self.figure) #You must set up the canvas before creating the 3D axes self.axes = Axes3D(self.figure) # ...
Perhaps this should be documented somehow? Or maybe a new mplot3d example code should be added. Or maybe
Axes3D.mouse_init() should warn the user if self.figure.canvas is None.
-Ben
-----Original Message-----
From: Ben Axelrod [mailto:BAx...@co...]
Sent: Monday, February 01, 2010 3:56 PM
To: mat...@li...
Subject: [Matplotlib-users] Axes3D rotation not working when embedded in backend
I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the "scatter3d_demo.py". I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it?
I tested with the latest SVN tree on Linux and Windows.
Thanks,
-Ben
Below is some sample code adapted from "embedding_in_wx2.py", but with an Axes3D instead of the regular plot:
#!/usr/bin/env python
# adapted from example code "embedding_in_wx2.py"
# Used to guarantee to use at least Wx2.8 import wxversion
wxversion.ensureMinimal('2.8')
import numpy as np
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_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
import wx
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()
 self.axes = Axes3D(self.figure)
 
 xs = np.random.rand(100)
 ys = np.random.rand(100)
 zs = np.random.rand(100)
 self.axes.scatter(xs, ys, zs)
 
 self.canvas = FigureCanvas(self, -1, self.figure)
 self.sizer = wx.BoxSizer(wx.VERTICAL)
 self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 self.SetSizer(self.sizer)
 self.Fit()
 self.add_toolbar() # comment this out for no toolbar
 def add_toolbar(self):
 self.toolbar = NavigationToolbar2Wx(self.canvas)
 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()
 def OnPaint(self, event):
 self.canvas.draw()
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()
#end code
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: David M. <mac...@ec...> - 2010年02月08日 15:22:35
Jeff Whitaker wrote:
> 
> zxc wrote:
>> Hi there!
>> I need to know how to close a figure/chart in matplot.
>>
>> Does anyone know how it works and could you please explain on the 
>> example below?
>> The problem is: close(1) doesn't close the figure 1 and when the 2nd 
>> figure will be plot the program hangs.
>> I tried with draw() but the figure doesn't appear.
> 
> Use fig.close()
> 
>>> fig.close()
Traceback (most recent call last):
 - - - 
AttributeError: 'Figure' object has no attribute 'close'
I think you mean plt.close(). This seems to suspend IDLE, and activate the
plot and console windows. To get back, I use "exit" in the console window.
Try using the draw() command instead of show(). Sometimes you need to issue
this command twice.
If I ever get this figured out, I'll write a HOWTO note.
-- 
View this message in context: http://old.nabble.com/How-to-close-a-plot--tp27490895p27501480.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Filipe P. A. F. <oc...@gm...> - 2010年02月08日 14:57:17
Thanks, that worked perfectly.
Best, Filipe
On Mon, Feb 8, 2010 at 8:39 AM, Stephane Raynaud <ste...@gm...
> wrote:
> Hi Filipe,
>
> you can fist use the quiver() function in the classic way for stick plots,
> then use gca().xaxis_date().
>
> Here is a simple example :
>
> import pylab as P
> # t may be generated using date2num()
> t = P.arange(100,110,.1)
> u = P.sin(t)
> v = P.cos(t)
> P.quiver([t],[[0]*len(t)],u,v)
> P.gca().xaxis_date()
> P.show()
>
>
> On Sun, Feb 7, 2010 at 6:11 PM, Filipe Pires Alvarenga Fernandes <
> oc...@gm...> wrote:
>
>> Hello list,
>>
>> I'm trying to create a stick-plot figure using the quiver function from
>> matplotlib. However, I'm failing miserably to plot dates in the x-axis. Has
>> anyone done this before? Also, is there an effort to create a stickplot
>> function?
>>
>> Thanks, Filipe
>>
>> *****************************************************
>> Filipe Pires Alvarenga Fernandes
>>
>> University of Massachusetts Dartmouth
>> 200 Mill Road - Fairhaven, MA
>> Tel: (508) 910-6381
>> Email: fal...@um...
>> oc...@ya...
>> oc...@gm...
>>
>> http://ocefpaf.tiddlyspot.com/
>> *****************************************************
>>
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
>> business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Stephane Raynaud
>
From: Alan G I. <ala...@gm...> - 2010年02月08日 14:43:25
On 2/6/2010 2:35 PM, Wayne Watson wrote:
> I'm not even sure if we are pro-pylab or pyplot as the preferred-style.
It is somewhat personal preference:
do you want access to NumPy and pyplot functions
in a single name space or not. But the "preferred"
style is the most explicit:
http://matplotlib.sourceforge.net/faq/usage_faq.html
Alan Isaac
(just another user...)
From: Maximilian M. <zw...@we...> - 2010年02月08日 14:14:05
<body bgcolor="#ffffff" background="https://img.web.de/v/p.gif" class="bgRepeatYes" style="background-repeat: repeat; ; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 9pt; padding-left: 0px;" ><span style="font-size: 9pt;"><span style="font-family: verdana,geneva;"><span style="background-color: transparent;"><span style="color: #000000;"><span style="color: #000000;">&nbsp;</span></span></span></span></span>Hello! <br /><br />I'm writing an application that will show different plots on it's GUI. In order to switch between the different plot types I'd like to destroy the first plot and to create a new afterwards. I stumbled into a memory leak since I don't know how to close matplotlib figures the clean way. <br /><br />I wrote a small test programm. Pressing the button 'create' creates a figure and 'delete' should destroy it. <br />Since the graph class is derived from the Tix.Frame class I would expect that destroying the Frame would also remove all matplot stuff. But when I do not implement my own destroy() method in the graph class, destroying the Frame shows absolutely no effect. The plot simply stays on the screen. <br />When I overload the Tix.Frame.destroy() method with my own implementation, as shown below, the plot disappears but not all memory is being released. When creating and deleting figures, the amount of memory python needs is constantly growing and python eventually crashes. <br /><br />I tried to find a solution on the internet but I found nothing really helpful so far. All examples I found just display something and then just exit. <br /><br />I appreciate any help! <br /><br />-------------- <br /><br />import matplotlib <br />matplotlib.use('TkAgg') <br /><br />from numpy import arange, sin, pi <br />from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg <br />from matplotlib.figure import Figure <br /><br /><br />import Tix <br />import sys <br /><br />def destroy(e): sys.exit() <br /><br />root = Tix.Tk() <br /><br /><br />class graph(Tix.Frame): <br />&nbsp; &nbsp; def __init__(self, master, **kw): <br />&nbsp; &nbsp; &nbsp; &nbsp; Tix.Frame.__init__(self, master, **kw) <br /><br />&nbsp; &nbsp; &nbsp; &nbsp; self.f = Figure(figsize=(5,4), dpi=100) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.a = self.f.add_subplot(111) <br />&nbsp; &nbsp; &nbsp; &nbsp; t = arange(0.0,3.0,0.01) <br />&nbsp; &nbsp; &nbsp; &nbsp; s = sin(2*pi*t) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.a.plot(t,s) <br /><br />&nbsp; &nbsp; &nbsp; &nbsp; self.canvas = FigureCanvasTkAgg(self.f, master=self.master) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.canvas.show() <br />&nbsp; &nbsp; &nbsp; &nbsp; self.canvas.get_tk_widget().pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) <br /><br />&nbsp; &nbsp; &nbsp; &nbsp; self.toolbar = NavigationToolbar2TkAgg(self.canvas, root ) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.toolbar.update() <br />&nbsp; &nbsp; &nbsp; &nbsp; self.canvas._tkcanvas.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; def destroy(self): <br />&nbsp; &nbsp; &nbsp; &nbsp; Tix.Frame.destroy(self) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.toolbar.destroy() <br />&nbsp; &nbsp; &nbsp; &nbsp; self.canvas._tkcanvas.destroy() <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />class ui(Tix.Frame): <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; g = None <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; def __init__(self, master, **kw): <br />&nbsp; &nbsp; &nbsp; &nbsp; Tix.Frame.__init__(self, master, **kw) <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; self.b = Tix.Button(self, text='create', command=self.create) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.b.pack() <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; self.b2 = Tix.Button(self, text='delete', command=self.delete) <br />&nbsp; &nbsp; &nbsp; &nbsp; self.b2.pack() <br /><br />&nbsp; &nbsp; def delete(self): <br />&nbsp; &nbsp; &nbsp; &nbsp; try: <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.g.destroy() <br />&nbsp; &nbsp; &nbsp; &nbsp; except: <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; def create(self): <br />&nbsp; &nbsp; &nbsp; &nbsp; self.delete() <br />&nbsp; &nbsp; &nbsp; &nbsp; self.g = graph(root) <br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />ui(root).pack() <br />root.mainloop()&nbsp;&nbsp;<br><br><table cellpadding="0" cellspacing="0" border="0"><tr><td bgcolor="#000000"><img src="https://img.web.de/p.gif" width="1" height="1" border="0" alt="" /></td></tr><tr><td style="font-family:verdana; font-size:12px; line-height:17px;">GRATIS f&uuml;r alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!&nbsp;&nbsp;&nbsp;<br>Jetzt freischalten unter http://movieflat.web.de</td></tr></table>
</body>
From: Jae-Joon L. <lee...@gm...> - 2010年02月08日 14:08:13
axes_grid uses a custome axes class. See
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
For more details, see
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html
To make ticklabel visible, you may do
 grid.axes_all[1].axis["bottom"].major_ticklabels.set_visible(True)
However, AxesGrid takes an *ngrids* parameter which controls the
number of grids. So, in your example,
f = plt.figure()
grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), ngrids=3)
(no manual adding of grids. also top-right axes will have x-ticklabels
by default).
Regards,
-JJ
On Mon, Feb 8, 2010 at 7:09 AM, Ernest Adrogué <ead...@gm...> wrote:
> Hi,
>
> I have an AxesGrid instance of 2x2 subplots. I actually only
> want 3 subplots, so I instantiate AxesGrid with the add_all=False
> option, and manually add only the first 3 axes to the figure:
>
> import matplotlib as plt
> from mpl_toolkits import axes_grid
>
> f = plt.figure()
> grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), add_all=False)
> f.add_axes(grid.axes_all[0])
> f.add_axes(grid.axes_all[1])
> f.add_axes(grid.axes_all[2])
>
>
> Now, the problem seems to be that the top right subplot doesn't
> have visible labels on the x axis, and I can't figure out how to
> add them. Any idea of how it can be done??
>
> Thanks.
>
> Ernest
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Stephane R. <ste...@gm...> - 2010年02月08日 14:03:57
Hi Filipe,
you can fist use the quiver() function in the classic way for stick plots,
then use gca().xaxis_date().
Here is a simple example :
import pylab as P
# t may be generated using date2num()
t = P.arange(100,110,.1)
u = P.sin(t)
v = P.cos(t)
P.quiver([t],[[0]*len(t)],u,v)
P.gca().xaxis_date()
P.show()
On Sun, Feb 7, 2010 at 6:11 PM, Filipe Pires Alvarenga Fernandes <
oc...@gm...> wrote:
> Hello list,
>
> I'm trying to create a stick-plot figure using the quiver function from
> matplotlib. However, I'm failing miserably to plot dates in the x-axis. Has
> anyone done this before? Also, is there an effort to create a stickplot
> function?
>
> Thanks, Filipe
>
> *****************************************************
> Filipe Pires Alvarenga Fernandes
>
> University of Massachusetts Dartmouth
> 200 Mill Road - Fairhaven, MA
> Tel: (508) 910-6381
> Email: fal...@um...
> oc...@ya...
> oc...@gm...
>
> http://ocefpaf.tiddlyspot.com/
> *****************************************************
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the
> business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Stephane Raynaud
From: Ernest A. <ead...@gm...> - 2010年02月08日 12:07:41
Hi,
I have an AxesGrid instance of 2x2 subplots. I actually only
want 3 subplots, so I instantiate AxesGrid with the add_all=False
option, and manually add only the first 3 axes to the figure:
import matplotlib as plt
from mpl_toolkits import axes_grid
f = plt.figure()
grid = axes_grid.AxesGrid(f, 111, nrows_ncols=(2,2), add_all=False)
f.add_axes(grid.axes_all[0])
f.add_axes(grid.axes_all[1])
f.add_axes(grid.axes_all[2])
Now, the problem seems to be that the top right subplot doesn't
have visible labels on the x axis, and I can't figure out how to
add them. Any idea of how it can be done??
Thanks.
Ernest

Showing results of 33

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