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


Showing 23 results of 23

From: John P. <jo...@ot...> - 2005年03月16日 23:27:01
Hello,
When I run:
from pylab import *
data = [1.6e-012, 3.0e-012]
plot(data)
the y axis autoscales to 1.8e-12 - 3.2e-12. I get the same behavior when 
I run in interactive mode or save the figure to png.
Does anyone know if this is a bug or if there's something I can do to 
make the autoscaling work out?
Thanks,
John
P.S. Here's the output from the --verbose-helpful flag:
matplotlib data path c:\pyle\python23\share\matplotlib
loaded rc file c:\pyle\python23\share\matplotlib\.matplotlibrc
matplotlib version 0.72.1
verbose.level helpful
interactive is False
platform is win32
numerix numarray 1.2.2
font search path ['c:\\pyle\\python23\\share\\matplotlib']
loaded ttfcache file C:/msys/1.0/home/artsys\.ttffont.cache
backend Agg version v2.2
From: John H. <jdh...@ac...> - 2005年03月16日 23:21:57
>>>>> "Perry" == Perry Greenfield <pe...@st...> writes:
 Perry> My guess is that the hold mode is true (that's the
 Perry> default). I think this means that every time you call
 Perry> .pcolor that you are just appending another one to the
 Perry> axes. You should either change the default hold mode or
 Perry> call the .clear() method of the axes object before calling
 Perry> the .pcolor method. If you don't do that it is rendering n
 Perry> previous versions and the time it takes grows linearly.
Good catch Perry. You need
sp.hold(False)
 >> P.S. At risk of distracting from the main problem: I am not
 >> entirely sure I'm commanding a redraw in the correct
 >> fashion. I'm fuzzy on the difference between show and
 >> plot. Using canvas.show() and canvas.plot() both seem to
 >> work. Just calling plot() doesn't. Any hints on this or
 >> pointers to documentation would be appreciated.
Se http://matplotlib.sourceforge.net/faq.html#SHOW
 >> Also, is pcolor documented anywhere?
From the python shell
 In [1]: fig = figure()
 In [2]: sp = fig.add_subplot(111)
 In [3]: help(sp.pcolor)
All the class docs can be found at
http://matplotlib.sourceforge.net/classdocs.html. In particular,
http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-pcolor
 >> ----- the code -----
Your code was improperly line wrapped and hence I had to edit it to
test it. Please check that when you paste code in, it does not
improperly wrap.
Hope this helps,
JDH
From: Perry G. <pe...@st...> - 2005年03月16日 23:00:16
My guess is that the hold mode is true (that's the default). I think 
this means that every time you call .pcolor that you are just appending 
another one to the axes. You should either change the default hold mode 
or call the .clear() method of the axes object before calling the 
.pcolor method. If you don't do that it is rendering n previous 
versions and the time it takes grows linearly.
Perry
On Mar 16, 2005, at 2:47 PM, Russell E. Owen wrote:
> I have appended some code which draws a varying pcolor plot in a 
> Tkinter
> window. The plot shows two 5x5 white rings which shrink to 3x3 and then
> 1x3, then cycles through this repeatedly.
>
> Unfortunately, it slows down with each cycle!!!
>
> Are we doing something wrong? Or can we work around the problem 
> somehow?
>
> (By the way, I did not write the code, though I cleaned up some 
> portions
> of it. I realize the data generation can be cleaned up, but it's not
> slowing things down).
>
> -- Russell
>
> P.S. At risk of distracting from the main problem: I am not entirely
> sure I'm commanding a redraw in the correct fashion. I'm fuzzy on the
> difference between show and plot. Using canvas.show() and canvas.plot()
> both seem to work. Just calling plot() doesn't. Any hints on this or
> pointers to documentation would be appreciated.
>
> Also, is pcolor documented anywhere?
>
> ----- the code -----
>
> import Tkinter as Tk
> from matplotlib.pylab import *
> import matplotlib.numerix as num
> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
> NavigationToolbar2TkAgg
>
> root = Tk.Tk()
> a =[ [0,1,2,3,4,5,6,\
> 90,91,92,93,94,95,96,15,30,45,\
> 60,75,21,36,51,66,81,\
> 8,9,10,11,12,13,14,98,99,\
> 100,101,102,103,104,\
> 23,38,53,68,83,29,44,59,74,89],\
> [16,17,18,19,20,76,77,78,79,80,35,50,65,\
> 31,46,61,24,25,26,27,28,\
> 84,85,86,87,88,39,54,69,43,58,73],\
> [32,33,34,62,63,64,47,49,40,41,42,\
> 70,71,72,55,57],\
> [48,56] ]
>
> ioff()
> f = figure(figsize=(3,3))
> sp = f.add_subplot(111)
> canvas = FigureCanvasTkAgg(f, master=root)
> canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
>
> def displayData(maxCount=20, delayTimeMS=20, count=0):
> fx = count % len(a)
> a[fx].sort()
> ra = []
> cnt = 0
> v = a[fx][cnt]
> for i in range(15*15):
> if i == v:
> ra.append(1)
> cnt += 1
> if cnt < len(a[fx]):
> v = a[fx][cnt]
>
> else:
> ra.append(0)
>
> z = num.reshape(ra, (15,15))
> sp.pcolor(transpose(z), cmap=cm.gray, norm=normalize())
> canvas.draw()
> count += 1
> if count < maxCount:
> root.after(delayTimeMS, displayData, maxCount, delayTimeMS,
> count)
>
> displayData(maxCount=100, delayTimeMS=20)
> root.mainloop()
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real 
> users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Joachim B H. <cj...@st...> - 2005年03月16日 21:18:45
John Hunter
<jdh...@ac...> writes:
> Perhaps Joachim would be better off using a gtk timer to handle his
> animation. Basically, matplotlib tries to provide a GUI neutral way
> to do animation (eg anim.py) but if you want to do something
> semi-sophisticated like alter the timing between draws, you should
> use the GUI specific functionality for this, eg gtk timers.
Thanks for the comments and example, John. I'll study it in detail
later.
For the moment I don't really want to do anything more advanced than
anim.py. The sleep() was only there to make the problem obviously
visible, but it was also present without it.
Longer term, I'd like to be able to pass in a 2d array of y values,
and get a window like the one show() presents, only with a "play"
button for animation plus a slider or similar to navigate to a
specific frame. I don't think this should be too hard, but I don't
know python yet so it may take some time.
The context is that I want to visualise time evolving partial
differential equations. (In general 3d complex-valued ones, but that's
a bit too much information to put in one plot.) So I have results from
the solver, for each time step, no real-time plotting or anything like
that.
Cheers, 
Joachim.
From: Russell E. O. <ro...@ce...> - 2005年03月16日 21:13:02
I have appended some code which draws a varying pcolor plot in a Tkinter 
window. The plot shows two 5x5 white rings which shrink to 3x3 and then 
1x3, then cycles through this repeatedly.
Unfortunately, it slows down with each cycle!!!
Are we doing something wrong? Or can we work around the problem somehow?
(By the way, I did not write the code, though I cleaned up some portions 
of it. I realize the data generation can be cleaned up, but it's not 
slowing things down).
-- Russell
P.S. At risk of distracting from the main problem: I am not entirely 
sure I'm commanding a redraw in the correct fashion. I'm fuzzy on the 
difference between show and plot. Using canvas.show() and canvas.plot() 
both seem to work. Just calling plot() doesn't. Any hints on this or 
pointers to documentation would be appreciated.
Also, is pcolor documented anywhere?
----- the code -----
import Tkinter as Tk
from matplotlib.pylab import *
import matplotlib.numerix as num
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, 
NavigationToolbar2TkAgg
root = Tk.Tk()
a =[ [0,1,2,3,4,5,6,\
90,91,92,93,94,95,96,15,30,45,\
60,75,21,36,51,66,81,\
8,9,10,11,12,13,14,98,99,\
100,101,102,103,104,\
23,38,53,68,83,29,44,59,74,89],\
[16,17,18,19,20,76,77,78,79,80,35,50,65,\
31,46,61,24,25,26,27,28,\
84,85,86,87,88,39,54,69,43,58,73],\
[32,33,34,62,63,64,47,49,40,41,42,\
70,71,72,55,57],\
[48,56] ]
ioff()
f = figure(figsize=(3,3))
sp = f.add_subplot(111)
canvas = FigureCanvasTkAgg(f, master=root)
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
def displayData(maxCount=20, delayTimeMS=20, count=0):
 fx = count % len(a)
 a[fx].sort()
 ra = []
 cnt = 0
 v = a[fx][cnt]
 for i in range(15*15):
 if i == v:
 ra.append(1)
 cnt += 1
 if cnt < len(a[fx]):
 v = a[fx][cnt]
 else:
 ra.append(0)
 z = num.reshape(ra, (15,15))
 sp.pcolor(transpose(z), cmap=cm.gray, norm=normalize())
 canvas.draw()
 count += 1
 if count < maxCount:
 root.after(delayTimeMS, displayData, maxCount, delayTimeMS, 
count)
displayData(maxCount=100, delayTimeMS=20)
root.mainloop()
From: Joachim B H. <cj...@st...> - 2005年03月16日 20:47:57
Joachim B Haga <cj...@st...> 
writes:
>> You may have something there. I tested different backends:
>> 
>> These show the problem: While these work fine:
>> 
>> GtkAgg WX 
>> QtAgg WXAgg 
>> CairoAgg GTK 
>> GtkCairo (yes, really) TkAgg 
Forget this list. I just discovered that -d<nonexistentbackend> 
silently defaults to GtkAgg, at least on my install (debian). So the
"problem" list probably boils down to GtkAgg. Maybe you knew that.
Steve Chaplin <ste...@ya...> writes:
> I've just fixed it in CVS, it should appear in the next matplotlib
> version. Or try installing from CVS if you need the fix now, and would
> like to test it.
Excellent! I'll wait; or, if you want me to test, tell me which file and
version it is so I can patch my install with the relevant changes.
Cheers,
Joachim.
From: <an...@tn...> - 2005年03月16日 20:41:59
Hi
After finally trying out Matplotlib, I am really impressed, and will stick to
it. And hear comes the first "would be nice to have" feature request:
o instead of secret keys for toggling the grid or the log-scaling of the axis,
 it would be nice to have buttons for this.
o toggling logplot on one or both axes would be nice, too, maybe with 'l' and
 'L', or with buttons
 
Thanks, Martin
-- 
Martin Lüthi an...@tn...
From: Fernando P. <Fer...@co...> - 2005年03月16日 19:28:45
John Hunter wrote:
>>>>>>"James" == James Boyle <bo...@ll...> writes:
> 
> 
> James> How would one get a colorbar() with a matshow plot? That
> James> is without altering the matshow code in pylab.,py.
> 
> A good question. The naive answer is: add the gci._current line to
> the matshow code below the imshow line
> 
> im = ax.imshow(*args,**kw)
> gci._current = im
> 
> 
> and then do
> 
> In [1]: matshow(rand(12,12))
> In [2]: colorbar()
> 
> The problem, of course, is that colorbar resizes the current axes,
> which defeats the purpose of matshow. 
> 
> What one needs is a colorbar kwarg to the matshow function that makes
> extra room for the colorbar and still preserves the aspect ratio.
> This would require some arithmetic and extra work. Any takers?
Well, I've been wanting this (I mentioned it to you in SF in passing) for a 
while. But I don't know the sizing code well enough to be able to write it up 
quickly. I'm just not terribly comfortable yet with the overall internal 
design of mpl. If nobody else does it I probably will, because I need it. 
But it will likely be _weeks_ before I even have a look.
best,
f
From: John H. <jdh...@ac...> - 2005年03月16日 19:06:07
>>>>> "john" == john <joh...@jp...> writes:
 john> Hello, I am trying to set a bar (a patched series of
 john> rectangles) with a fill pattern instead of
 john> just a solid color. Is there an easy way to do this in
 john> matplotlib?
 john> I am thinking of something like Qt's QBrush which has cross,
 john> vertical, dense, etc. patterns.
There is no support for this currently -- it wouldn't bee too hard to
add for backends that support this kind of thing. Basically, we need
to specify the API for it, and add support to backends. I have been
wanting to add gradient fills for patches (eg polygons, rectangles)
and it would be good to do both at once.
I know Ted has mentioned a desire to plot ellipses avoiding the
discretizations caused by manually computing the vertices. When the
migration to proper path drawing in mpl is complete, this would be
possible with splines or by exposing a backend draw_ellipse method.
For simplicity of design, I'm inclined to the former, but if you have
any suggestions here, let me know.
 
 john> Also, could you please tell me how to plot a rotated
 john> ellipse?
 There is no built-in support for this, but you can do it "the hard
 way" (example below).
I'm in the process of rethinking and refactoring the way mpl does
transformations, so if you have suggestions on how this could be done
better from an interface standpoint, please let me know. The code
below requires mpl CVS (but will be included in the next release,
possibly today)
 from matplotlib.agg import trans_affine
 from matplotlib.patches import Polygon
 from matplotlib.numerix import sin, cos, pi, arange
 import pylab
 rx = 2
 ry = 1
 angle = arange(0.0, 2*pi, 0.1)
 xs = rx*cos(angle)
 ys = ry*sin(angle)
 a = 2*pi*10./360. # 10 degrees
 trans = trans_affine(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0)
 verts = [tuple(trans.transform(x,y)) for x,y in zip(xs,ys)]
 poly = Polygon(verts)
 ax = pylab.subplot(111)
 ax.add_patch(poly)
 ax.autoscale_view()
 pylab.show()
JDH
From: John H. <jdh...@ac...> - 2005年03月16日 18:35:43
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> How would one get a colorbar() with a matshow plot? That
 James> is without altering the matshow code in pylab.,py.
A good question. The naive answer is: add the gci._current line to
the matshow code below the imshow line
 im = ax.imshow(*args,**kw)
 gci._current = im
and then do
In [1]: matshow(rand(12,12))
In [2]: colorbar()
The problem, of course, is that colorbar resizes the current axes,
which defeats the purpose of matshow. 
What one needs is a colorbar kwarg to the matshow function that makes
extra room for the colorbar and still preserves the aspect ratio.
This would require some arithmetic and extra work. Any takers?
Perry and I have been discussing some ideas to make this kind of
layout easier. The problem is that the figure size is picked first,
and the axes are fractions of that. In addition to the current
functionality, it would be nice to have a figure container that
resized itself, and axes that were in physical sizes. Eg, something
like
 fig = FigureDynamic()
 ax = AxesSized(5,5) # inches
 cax = AxesSized(.5,5) # inches
 fig.hbox.add(ax)
 fig.hbox.add(cax)
 X = rand(12,12)
 ax.imshow(X) # aspect ratio is correct since axwidth=axheight
 fig.colorbar(cax)
When you add the axes, the figure window would resize itself to
accommodate them, which is the inverse of what happens currently --
the axes physical dimensions resize themselves according to the figure
physical size. I think both approaches are useful.
JDH
From: James B. <bo...@ll...> - 2005年03月16日 18:11:52
How would one get a colorbar() with a matshow plot?
That is without altering the matshow code in pylab.,py.
--Jim
From: Chris B. <Chr...@no...> - 2005年03月16日 17:52:39
Hi all,
A user discovered that I had built only Numeric support, and not 
numarray support, into my OS-X matplotlib package. I've fixed that, and 
you can find the new version at:
http://www.pythonmac.org/packages/matplotlib-0.72.1-py2.3-macosx10.3.zip
It supports Numeric and/or numarray, and the Tk, Wx, and Agg back-ends. 
Note that TK and Wx are a bit weird, they both can crash python when you 
close the window. I'm only using the Agg back-end myself at the moment, 
so I'm not going to figure this out, but it would be great if someone did!
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: john <joh...@jp...> - 2005年03月16日 17:33:46
Hello,
 
I am trying to set a bar (a patched series of rectangles) with a fill
pattern instead of 
just a solid color. Is there an easy way to do this in matplotlib?
I am thinking of something like Qt's QBrush which has cross, vertical,
dense, etc. patterns.
 
Also, could you please tell me how to plot a rotated ellipse?
 
Thanks, 
John Schwartz (JPL, Monte project)
From: John H. <jdh...@ac...> - 2005年03月16日 17:28:42
>>>>> "andrea" == andrea gavana <and...@ti...> writes:
 andrea> Hello John and NG,
 >> I answered this question before at
 >> 
 >> http://sourceforge.net/mailarchive/message.php?msg_id=11115023
 >> 
 andrea> Probably I did not make myself clear.
 >> In a nutshell, do not manually bind 'g' to toggle the grid.
 >> This already happens by default in matplotlib 0.72.
 andrea> I am NOT manually binding the "g" key! I have NO
 andrea> key_press_event on my routines. Similarly, the examples:
 andrea> - embedding_in_wx.py - embedding_in_wx2.py -
 andrea> wxcursor_demo.py
OK, I see. Sorry for the confusion. The default keybindings are made
in the backend FigureManager classes. All of the examples you
referenced embed matplotlib in a wx app. The ones that use the
FigureManagerWX (eg embedding_in_wx.py) have the default key bindings;
the ones that don't use FigureManagerWX (eg embedding_in_wx2.py), do
not. If you don't use the manager, you have to do the bindings you
want yourself. Eg, in embedding_in_wx2.py
 self.axes.plot(t,s)
 self.canvas = FigureCanvas(self, -1, self.figure)
 def toggle_grid(event):
 self.axes.grid()
 self.canvas.draw()
 self.canvas.mpl_connect('key_press_event', toggle_grid)
Hope this helps,
JDH
 
From: <and...@ti...> - 2005年03月16日 16:57:44
Hello John and NG,
>I answered this question before at
>
> http://sourceforge.net/mailarchive/message.php?msg_id=3D11115023
>
Probably I did not make myself clear.
>In a nutshell, do not manually bind 'g' to toggle the grid. This
>already happens by default in matplotlib 0.72. 
I am NOT manually binding the "g" key! I have NO key_press_event on my ro=
utines.
Similarly, the examples:
- embedding_in_wx.py
- embedding_in_wx2.py
- wxcursor_demo.py
The is NOT any key_press_event. So there is no manually binding of char
events (in my understanding). Moreover, I can click many times in the WX
window (as you suggested), but the binding of the "g" char is never activ=
ated
on the following demos:
- embedding_in_wx2.py
- wxcursor_demo.py
For the embedding_in_wx.py demo, you are right, John. You have to click
on the WX window in order to get the "g" behavior, that works. 
I don't really know why you need to click on the window to activate the
char binding... probably Robin Dunn may have an answer to this problem.
Thanks to you all.
Andrea.
 
From: Humufr <hu...@ya...> - 2005年03月16日 16:54:55
I have this script:
from pylab import *
from numarray import *
a = arange(10)
scatter(a,a,c=a,s=60,cmap=cm.winter)
colorbar()
show()
but instead to have the brighter point in green I want to have them in 
blue. To obtain it I did a stupid things and I invert the map:
from pylab import *
from numarray import *
a = arange(10)
scatter(a,a,c=-a,s=60,cmap=cm.winter)
colorbar()
show()
but the colormap scale is in good direction green to blue but negative. 
Do you know how can I correct this perhaps it's not possible and the 
anly way to do this is to create a new color map?
Thanks,
N.
From: Humufr <hu...@ya...> - 2005年03月16日 16:49:43
Hi,
so the scripts to see my problem with the colorbar are:
script 1:
from pylab import *
from numarray import *
a = arange(10)
scatter(a,a,c=a,s=60,cmap=cm.winter)
colorbar(orientation='horizontal')
show()
script 2:
from pylab import *
from numarray import *
a = arange(10)
scatter(a,a,c=a,s=60,cmap=cm.winter)
colorbar()
show()
The first script must have (I think) a scale for the colorbar between 0 
and 10 like it is in the vertical mode but it's only a guess and I 
probably misunderstood something else.
Thanks,
 N.
From: Natsu <nat...@ya...> - 2005年03月16日 16:31:53
Hi,
After resolving the font_manager.py issue, I could fire up pylab on
Japanese Win 2K. However, on my Win XP Japanese PCs, there seems
some trouble remaining.
The following result was obtained with Enthogut python 2.3.3 on XP
professional Version 2002 SP1, Japanese.
On other PC with XP SP2, Japanese, I got a similar error.
So I'm afraid it is repeatable to any Japanese Win XP.
Maybe, my WinXPs are not fresh and clean. What do you think?
I'm ready to test the special debugging build which was mentioned in the
list earlier, if the binaries are sent to me.
--
Natsu
>python
Enthought Edition build 1056
Python 2.3.3 (#51, Feb 16 2004, 04:07:52) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z
>python simple_plot.py --verbose-helpful
matplotlib data path C:\Python23\share\matplotlib
loaded rc file C:\Python23\share\matplotlib\.matplotlibrc
matplotlib version 0.72.1
verbose.level helpful
interactive is False
platform is win32
numerix Numeric 23.3
font search path ['C:\\Python23\\share\\matplotlib']
Then a message box appears telling that python.exe is quitting.
The box has a link and a "debug" button.
The "debug" button tells that
The instruciton "0x1e07460e" refers to memory at "0x00000000".
It could not be "read". (in Japanese)
The link gudes to an other message box which tells that the error
signature is as follows:
AppName: python.exe	 AppVer: 0.0.0.0	 ModName: python23.dll
ModVer: 2.3.3150.1012	 Offset: 0007460e
>python -v
--- snip ---
>>> import pylab
--- snip ---
import matplotlib.lines # precompiled from
C:\Python23\lib\site-packages\matplotlib\lines.pyc
# C:\Python23\lib\site-packages\matplotlib\patches.pyc matches
C:\Python23\lib\site-packages\matplotlib\patches.py
import matplotlib.patches # precompiled from
C:\Python23\lib\site-packages\matplotlib\patches.pyc
# C:\Python23\lib\site-packages\matplotlib\path.pyc matches
C:\Python23\lib\site-packages\matplotlib\path.py
import matplotlib.path # precompiled from
C:\Python23\lib\site-packages\matplotlib\path.pyc
# C:\Python23\lib\site-packages\matplotlib\ticker.pyc matches
C:\Python23\lib\site-packages\matplotlib\ticker.py
import matplotlib.ticker # precompiled from
C:\Python23\lib\site-packages\matplotlib\ticker.pyc
# C:\Python23\lib\site-packages\matplotlib\font_manager.pyc matches
C:\Python23\lib\site-packages\matplotlib\font_manager.py
import matplotlib.font_manager # precompiled from
C:\Python23\lib\site-packages\matplotlib\font_manager.pyc
# C:\Python23\lib\glob.pyc matches C:\Python23\lib\glob.py
import glob # precompiled from C:\Python23\lib\glob.pyc
# C:\Python23\lib\fnmatch.pyc matches C:\Python23\lib\fnmatch.py
import fnmatch # precompiled from C:\Python23\lib\fnmatch.pyc
# C:\Python23\lib\site-packages\matplotlib\afm.pyc matches
C:\Python23\lib\site-packages\matplotlib\afm.py
import matplotlib.afm # precompiled from
C:\Python23\lib\site-packages\matplotlib\afm.pyc
import matplotlib.ft2font # dynamically loaded from
C:\Python23\lib\site-packages\matplotlib\ft2font.pyd
# C:\Python23\lib\posixpath.pyc matches C:\Python23\lib\posixpath.py
import posixpath # precompiled from C:\Python23\lib\posixpath.pyc
import _winreg # dynamically loaded from C:\Python23\DLLs\_winreg.pyd
import cPickle # builtin
Then the message box appears.
>>>>> "Natsu" == Natsu <nat...@ya...> writes:
 >> try: key, direc, any = _winreg.EnumValue( local, j) if not
 >> os.path.dirname(direc): direc = os.path.join(directory, direc)
 >> direc = os.path.abspath(direc).lower() if direc[-4:] ==
 >> '.'+fontext: items[direc] = 1 except EnvironmentError: pass
Thanks for the patch -- this will be in the next release.
 Natsu> The idea is taken from a Japanese blog.
 Natsu> http://somethingred.dip.jp/blog/239
 Natsu> The author of the Blog seems to have some idea to patch
 Natsu> _winreg, also.
 Natsu> http://somethingred.dip.jp/blog/253 -- Natsu Mizutani
Perhaps you can contact the winreg maintainers and let them know about
this...
Thanks!
JDH
From: John H. <jdh...@ac...> - 2005年03月16日 15:15:44
>>>>> "andrea" == andrea gavana <and...@ti...> writes:
 andrea> - embedding_in_wx.py
 andrea> The "g" key works fine, the grid is shown/hidden when you
 andrea> hit this key. I'm having the same problem in my
 andrea> application, I can not show the grid for some reason, and
 andrea> it seems to me that these 2 problems are related.
 andrea> Do you have any suggestion/pointer?
I answered this question before at
 http://sourceforge.net/mailarchive/message.php?msg_id=11115023
In a nutshell, do not manually bind 'g' to toggle the grid. This
already happens by default in matplotlib 0.72. 
In WX* you have to click on the figure before any of the keypress
functionality is activated (does anyone know how to fix this?)
JDH
From: John H. <jdh...@ac...> - 2005年03月16日 15:13:16
>>>>> "Eliot" == Eliot R Smith <es...@in...> writes:
 Eliot> The following test program dies with an error when used
 Eliot> with the arguments shown -- but cutting back the argument
 Eliot> lists by even one element allows it to work OK. So does
 Eliot> taking out the hold(False). This is with Mac OS X, Apple
 Eliot> Python 2.3, Matplotlib version 0.71, __revision__
See the release notes for matplotlib-0.72, specifically
 log plot enhancements
 Lots of work making log plots just work. You can toggle log y axes
 with the l ("ell") keypress -- nonpositive data are simply ignored
 and no longer raise. log plots should be a lot faster and more
 robust
Hope this helps!
JDH
From: John H. <jdh...@ac...> - 2005年03月16日 15:11:31
>>>>> "Steve" == Steve Chaplin <ste...@ya...> writes:
 Steve> I ran the script with GTKCairo and it looks fine to me.
 Steve> Perhaps you are using GTKAgg which looks like it has the
 Steve> problem. My guess is that its caused by using
 Steve> gtk.idle_add() which results in asynchronous expose_event
 Steve> updates.
I looked at this briefly and am a little confused by something. The
base class FigureCanvasGTK.expose_event has this in the doc string
 """Expose_event for all GTK backends
 Should not be overridden.
but then the derived class 
 class FigureCanvasGTKAgg(FigureCanvasGTK, FigureCanvasAgg):
does in fact override it.
I inserted a debug print statement into
FigureCanvasGTKAgg.expose_event and it is not called until the loop is
over. I think this is because the call to sleep is preventing the
idle handler from ever getting engaged.
Perhaps Joachim would be better off using a gtk timer to handle his
animation. Basically, matplotlib tries to provide a GUI neutral way
to do animation (eg anim.py) but if you want to do something
semi-sophisticated like alter the timing between draws, you should use
the GUI specific functionality for this, eg gtk timers.
Here is an example
# animate increasing terms in fourier expansion of y=x
import pygtk
pygtk.require('2.0')
import gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.numerix import arange, pi, sin, zeros, Float
import pylab
class Animator:
 
 def __init__(self, samples=1000, max_k=30):
 self.samples = samples
 self.max_k = max_k
 self.fig = pylab.figure()
 self.ax = self.fig.add_subplot(111)
 x = arange(0.0, 1.0, 1.0/self.samples)
 self.s = zeros((self.max_k,samples), Float)
 for k in range(1,self.max_k):
 self.s[k] = self.s[k-1]+(-1)**(k+1)*sin(pi*x*k)/k
 self.line, = self.ax.plot(x, x*1.3, linewidth=1.0)
 self.ax.grid(True)
 self.k = 1
 def draw(self, *args):
 
 self.line.set_ydata(2./pi*self.s[self.k])
 self.ax.set_title('k = '+str(self.k))
 pylab.draw()
 self.k += 1
 return self.k<self.max_k
anim = Animator()
gtk.timeout_add(100,anim.draw)
pylab.show()
From: John H. <jdh...@ac...> - 2005年03月16日 14:21:57
>>>>> "Shidai" == Shidai Liu <shi...@gm...> writes:
 >> Greetings all, trivial problem, don't know if it's my machine
 >> problem.
 >> 
 >> <<< plot([1,2,3],'gx')
 >> 
 >> fails to plot the canvas.
 >> 
 >> Py2.3 + Pylab .70
This will be fixed in the next release -- thanks.
JDH

Showing 23 results of 23

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