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






Showing results of 523

<< < 1 .. 5 6 7 8 9 .. 21 > >> (Page 7 of 21)
From: Andrew S. <str...@as...> - 2009年05月21日 23:07:20
Adam Mercer wrote:
> On Wed, May 20, 2009 at 21:25, John Hunter <jd...@gm...> wrote:
> 
>> The problem here is that I built the site docs from svn, not the last
>> release. 0.98.6svn is the version stamp from svn. I have mixed
>> feelings about fixing this. On the one hand, there is merit to having
>> the site docs reflect the current stable release. On the other hand,
>> I like pushing people onto svn HEAD, because this is where all the
>> latest features and bugfixes are. By building the site docs from svn,
>> viewers of the gallery and examples directories, as well as the
>> plain-ol-docs, get a peak at what is possible from svn. If they try
>> it and find their latest installation doesn't support it, after
>> complaining on the mailing list they may try installing svn. And that
>> is a plus for mpl, because we have more testers on svn HEAD and more
>> potential developers.
> 
> That makes sense, however the reason I was asking is that I am the
> maintainer of the MacPorts matplotlib port and I wanted to a way to
> check for the latest release, I had been using a regex to the check
> the latest version as displayed on home page but when this was updated
> to the svn release this broke. Also as the 0.98.5.3 release is not a
> specific release but a sub release of 0.98.5 I can't use the
> sourceforge downloads page to query this.
> 
> It would be really helpful if a page was provided that listed the
> latest stable release that packagers could use to automatically query.
If there's a port of uscan for MacPorts (
http://manpages.debian.net/cgi-bin/man.cgi?query=uscan ) you could
simply use the debian watch file. It's contents are:
version=3
http://sf.net/matplotlib/matplotlib-([0-9]+(?:\.[0-9]+)*)\.tar\.gz
From: Adam M. <ram...@gm...> - 2009年05月21日 22:19:45
On Wed, May 20, 2009 at 21:25, John Hunter <jd...@gm...> wrote:
> The problem here is that I built the site docs from svn, not the last
> release. 0.98.6svn is the version stamp from svn. I have mixed
> feelings about fixing this. On the one hand, there is merit to having
> the site docs reflect the current stable release. On the other hand,
> I like pushing people onto svn HEAD, because this is where all the
> latest features and bugfixes are. By building the site docs from svn,
> viewers of the gallery and examples directories, as well as the
> plain-ol-docs, get a peak at what is possible from svn. If they try
> it and find their latest installation doesn't support it, after
> complaining on the mailing list they may try installing svn. And that
> is a plus for mpl, because we have more testers on svn HEAD and more
> potential developers.
That makes sense, however the reason I was asking is that I am the
maintainer of the MacPorts matplotlib port and I wanted to a way to
check for the latest release, I had been using a regex to the check
the latest version as displayed on home page but when this was updated
to the svn release this broke. Also as the 0.98.5.3 release is not a
specific release but a sub release of 0.98.5 I can't use the
sourceforge downloads page to query this.
It would be really helpful if a page was provided that listed the
latest stable release that packagers could use to automatically query.
Cheers
Adam
From: Todd P. <Tod...@li...> - 2009年05月21日 21:51:46
Hi, I'm new to matplotlib, trying to migrate from Matlab, so please 
excuse my rookie ignorance and Matlab thinking.
My question is: why does a GUI figure crash upon repeated calls in 
IPython?
Here is a detailed description:
I'm using the Enthought Python Distribution (EPD_Py25) and I enter 
IPython with the command: "ipython". I then run the script below 
using: %run myScript.py. Everything works fine: when I press 'Enter' 
while in the GUI the figure closes and I can retrieve the data from 
obj.x. However, when I run the script again using %run myScript.py a 
figure is generated but nothing happens; I am forced to reset 
everything using pyplot.close('all'), but cannot regain the GUI 
functionality without exiting IPython.
This problem does not occur if I use EPD's PyLab (i.e. "ipython - 
pylab"). Does anyone know why?
Here is the script:
from numpy.random import rand
from matplotlib import pyplot
class myGUI:
 def __init__(self,x):
 self.fig = pyplot.gcf()
 self.x = x
 #initiate figure:
 self.connect()
 pyplot.plot(self.x)
 pyplot.show()
 def connect(self):
 self.cidkeypress = 
self.fig.canvas.mpl_connect('key_press_event', self.keypress)
 def disconnect(self):
 self.fig.canvas.mpl_disconnect(self.cidkeypress)
 pyplot.close(self.fig)
 def keypress(self,event):
 if event.key == 'enter':
 self.disconnect()
 else:
 self.x = rand(self.x.size)
 pyplot.plot(self.x)
 self.fig.canvas.draw()
pyplot.figure()
obj = myGUI(rand(10))
From: John H. <jd...@gm...> - 2009年05月21日 14:28:12
On Mon, May 18, 2009 at 7:56 AM, John Hunter <jd...@gm...> wrote:
> I have uploaded the source and OSX binaries for the bugfix release of
> matplotlib-0.98.5.3 to
>
> http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194
>
> The windows binaries are not yet ready, so I'll followup to this email
> when they are up. Below is a summary of the bugfixes in this release
The windows binaries are now uploaded and ready. We had a problem due
to a binary incompatibility in numpy which was difficult to track
down. The solution was to build the matplotlib binaries against older
versions of numpy. According to my tests, the installers should work
with numpy 1.1 or later, but if you have trouble (eg an unexplained
segfault), try wiping your matplotlib and numpy installations, upgrade
numpy to the latest for your python version, and reinstall matplotlib.
Thanks to Charlie Moad for the windows builds.
JDH
From: Joshua J. K. <jo...@ee...> - 2009年05月21日 03:44:50
On Wednesday 20 May 2009, John Hunter said something like:
> On Wed, May 20, 2009 at 9:36 PM, Joshua J. Kugler 
<jo...@ee...> wrote:
> > So, my code has been running without flaw for quite some time now,
> > and thanks to the help of some folks here a few months back, I'm
> > learning more about matplotlib. But today I hit a wall.
> >
> > Under matplotlib 0.91.2/Py2.5, I'm getting this graph:
> > http://joshuakugler.com/images/good_graph.png
> >.. .snip
> > No, I haven't assembled a minimal test case (this is quite a
> > complex system, I spent several hours on this thinking I had broken
> > my code until it occurred to me to run it on an old Py2.5/mpl
> > 0.91.2 setup), and no I haven't trolled the changelogs to see what
> > change in behavior I might have hit, but I was wondering if anyone
> > any ideas of what I need to be checking off the top of their heads.
>
> You are running a really old mpl -- the last 0.91 release was about
> 16 months ago. If you want resolution against the latest tree, you
> will need to post an updated script exhibiting the problem.
I realize I was running an old MPL. Hmm...how does MPL define major 
releases? I didn't think there would be API or functionality breakage 
going from 0.91 to 0.98. So, does that mean if I update my program to 
run with 0.98, it will no longer work correctly under 0.91?
> > P.S. Oh, and there is also a nice traceback I'm getting on other
> > graphs that seems to be related to this glitch, but I'll wait until
> > I have the first glitch fixed as the second glitch may get fixed in
> > the process.
>
> Ahh, this is a tantalizing morsel. If only we had the traceback, we
> might be able to help...
Yeah, I know...but I didn't how related it was. For those who care, 
here it is, but I haven't been able to track down what's causing it, 
other than somewhere along the line my start/end points are getting set 
to inf and my code isn't doing it.
Traceback (most recent call last):
 File "./photizo_legacy_graph.py", line 187, in <module>
 'graphs', out_filename ))
 
File "/home/jkugler/programming/photizo/trunk/photizo/legacy/BaseFigure.py", 
line 69, in createImage
 self.layout()
 
File "/home/jkugler/programming/photizo/trunk/photizo/legacy/GWSFigures.py", 
line 31, in layout
 graph1.plotDate()
 
File "/home/jkugler/programming/photizo/trunk/photizo/legacy/BaseGraph.py", 
line 400, in plotDate
 line = self.main_axes.plot_date(g[:,0], g[:,1])
 File "/usr/lib/python2.6/dist-packages/matplotlib/axes.py", line 3348, 
in plot_date
 self.xaxis_date(tz)
 File "/usr/lib/python2.6/dist-packages/matplotlib/axes.py", line 2175, 
in xaxis_date
 locator.refresh()
 File "/usr/lib/python2.6/dist-packages/matplotlib/dates.py", line 559, 
in refresh
 dmin, dmax = self.viewlim_to_dt()
 File "/usr/lib/python2.6/dist-packages/matplotlib/dates.py", line 454, 
in viewlim_to_dt
 return num2date(vmin, self.tz), num2date(vmax, self.tz)
 File "/usr/lib/python2.6/dist-packages/matplotlib/dates.py", line 249, 
in num2date
 if not cbook.iterable(x): return _from_ordinalf(x, tz)
 File "/usr/lib/python2.6/dist-packages/matplotlib/dates.py", line 169, 
in _from_ordinalf
 ix = int(x)
OverflowError: cannot convert float infinity to integer
-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
From: John H. <jd...@gm...> - 2009年05月21日 02:57:10
On Wed, May 20, 2009 at 9:36 PM, Joshua J. Kugler <jo...@ee...> wrote:
> So, my code has been running without flaw for quite some time now, and
> thanks to the help of some folks here a few months back, I'm learning
> more about matplotlib. But today I hit a wall.
>
> Under matplotlib 0.91.2/Py2.5, I'm getting this graph:
> http://joshuakugler.com/images/good_graph.png
>.. .snip
> No, I haven't assembled a minimal test case (this is quite a complex
> system, I spent several hours on this thinking I had broken my code
> until it occurred to me to run it on an old Py2.5/mpl 0.91.2 setup),
> and no I haven't trolled the changelogs to see what change in behavior
> I might have hit, but I was wondering if anyone any ideas of what I
> need to be checking off the top of their heads.
You are running a really old mpl -- the last 0.91 release was about 16
months ago. If you want resolution against the latest tree, you will
need to post an updated script exhibiting the problem.
> P.S. Oh, and there is also a nice traceback I'm getting on other graphs
> that seems to be related to this glitch, but I'll wait until I have the
> first glitch fixed as the second glitch may get fixed in the process.
Ahh, this is a tantalizing morsel. If only we had the traceback, we
might be able to help...
JDH
JDH
From: Joshua J. K. <jo...@ee...> - 2009年05月21日 02:36:44
So, my code has been running without flaw for quite some time now, and 
thanks to the help of some folks here a few months back, I'm learning 
more about matplotlib. But today I hit a wall.
Under matplotlib 0.91.2/Py2.5, I'm getting this graph:
http://joshuakugler.com/images/good_graph.png
Very nice, that's what I want!
But when I started running under matplotlib 0.98.5.2/Py2.6, I started 
getting this:
http://joshuakugler.com/images/bad_scale.png
Not happy. I finally realized that autoscaling was enable for the 
secondary y axis (right side), even though it's explicitly turned off 
for the primar y axis (left side). So, I turn autoscaling off for the 
secondary axis and got this:
http://joshuakugler.com/images/bad_noscale.png
Better (proper range) but I have numbers instead of dates.
No, I haven't assembled a minimal test case (this is quite a complex 
system, I spent several hours on this thinking I had broken my code 
until it occurred to me to run it on an old Py2.5/mpl 0.91.2 setup), 
and no I haven't trolled the changelogs to see what change in behavior 
I might have hit, but I was wondering if anyone any ideas of what I 
need to be checking off the top of their heads.
I can tell you: the problem only occurrs on graphs that have a secondary 
y axis, as you can see, the humidity graph is just fine.
Ideas? Sections of the manual I need to read?
I'm frustrated and burnt out from trying to figure this out, so I'm done 
for the night...hopefully I'll have fresh insights and/or ideas come 
morning.
j
P.S. Oh, and there is also a nice traceback I'm getting on other graphs 
that seems to be related to this glitch, but I'll wait until I have the 
first glitch fixed as the second glitch may get fixed in the process.
-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
From: John H. <jd...@gm...> - 2009年05月21日 02:25:29
On Mon, May 18, 2009 at 5:34 PM, Adam Mercer <ram...@gm...> wrote:
> On Mon, May 18, 2009 at 07:56, John Hunter <jd...@gm...> wrote:
>> I have uploaded the source and OSX binaries for the bugfix release of
>> matplotlib-0.98.5.3 to
>>
>> http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194
>
> The homepage is saying that the latest release is 0.98.6svn, can this
> be corrected?
The problem here is that I built the site docs from svn, not the last
release. 0.98.6svn is the version stamp from svn. I have mixed
feelings about fixing this. On the one hand, there is merit to having
the site docs reflect the current stable release. On the other hand,
I like pushing people onto svn HEAD, because this is where all the
latest features and bugfixes are. By building the site docs from svn,
viewers of the gallery and examples directories, as well as the
plain-ol-docs, get a peak at what is possible from svn. If they try
it and find their latest installation doesn't support it, after
complaining on the mailing list they may try installing svn. And that
is a plus for mpl, because we have more testers on svn HEAD and more
potential developers.
We are endeavoring to get a regular buildbot process going, with
regular builds and possibly nightly binaries for multiple platforms.
That way, the site can stay on svn HEAD, and users who want to the
latest can be pointed to ready-built installers from the buildbots.
In the meantime, if you want your local installation to match the
version on the website, try installing from svn <wink>
 http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
JDH
From: Markus F. <fel...@gm...> - 2009年05月20日 23:45:21
Hi All,
i am programming an application which extracts binary values from 6
files and plots this values in a bar() element and another one.
The bar Elements are partial one upon the other. I think this results of
my my small x values.
y1 = [1 0]
y2 = [1 0]
y3 = [1 1]
x = [ 0. 0.0002149]
As you can see the x values are near the same.
here is a screenshot,
[url=http://img257.imageshack.us/my.php?image=problemmitkonverter.jpg][img=http://img257.imageshack.us/img257/3134/problemmitkonverter.th.jpg][/url]
My Code is at,
http://nopaste.debianforum.de/21481
here is a short code snippet:
##########################################################################
class GraphWindow(wx.Window):
 def __init__(self, *args, **kwargs):
 wx.Window.__init__(self, *args, **kwargs)
 self.lines = []
 self.figure = Figure()
 self.canvas = FigureCanvasWxAgg(self, -1, self.figure)
 f_dat = open('../../../peakswerteundzeit.dat','rb')
 nitems = 2
 self.a_time = cPickle.load(f_dat)
 self.a_a = cPickle.load(f_dat)
 self.a_b = cPickle.load(f_dat)
 self.a_c = cPickle.load(f_dat)
 self.a_ar = cPickle.load(f_dat)
 self.a_ai = cPickle.load(f_dat)
 self.a_br = cPickle.load(f_dat)
 self.a_bi = cPickle.load(f_dat)
 self.a_cr = cPickle.load(f_dat)
 self.a_ci = cPickle.load(f_dat)
 self.draw(nitems)
 def draw(self,nitems):
 if not hasattr(self, 'subplot1'):
 self.subplot1 = self.figure.add_subplot(211)
 self.subplot2 = self.figure.add_subplot(212)
 a = numpy.array(self.a_a[0:nitems])
 b = numpy.array(self.a_b[0:nitems])
 c = numpy.array(self.a_c[0:nitems])
 d = numpy.array(self.a_time[0:nitems])
 print a, b, c, d, numpy.add(a,b)
 bar1 = self.subplot1.bar(d,a, color='red', 
edgecolor='red',align='edge')
 bar2 = self.subplot1.bar(d,b, color='green', 
edgecolor='green',align='edge',
 bottom=a)
 bar3 = self.subplot1.bar(d,c, color='blue', 
edgecolor='blue',align='edge',
 bottom=numpy.add(a,b))
##########################################################################
Any Ideas how to avoid the one upon the other effect ?
I failed to get the xaxis towork.
Regards Markus
From: Christopher B. <Chr...@no...> - 2009年05月20日 23:14:38
Jeremy Lewi wrote:
> I would like to use matplotlib to incorporate plots into my fltk
> application.
 > The key point is that I
> want to display the figure in a non-blocking way so that control can
> return to my fltk application while the figure is still being displayed.
> To prototype this I have created a file containing the following python
> code
> 
> import sys
> import fltk
> import matplotlib
> matplotlib.use('FltkAgg')
cool! I didn't know there was an Fltk back-end.
> import pylab as p
> import time
> 	
> hf=p.figure()
but anyway, this is your issue. With all the GUI back-ends, if you wan 
to embed the figure in your own app, rather than have pylab create an 
app for you, you need to create the figure a different way, without 
pylab. See the various embedded_in _*** examples:
http://matplotlib.sourceforge.net/examples/user_interfaces/index.html
-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: Jeremy L. <jl...@in...> - 2009年05月20日 22:07:27
I would like to use matplotlib to incorporate plots into my fltk
application. I would like to do this by writing a python function to
create the appropriate graphic using matplotlib. When I want to update
the figure, I want to call an update function written by me in python
which computes the new graphic and displays it. The key point is that I
want to display the figure in a non-blocking way so that control can
return to my fltk application while the figure is still being displayed.
To prototype this I have created a file containing the following python
code
import sys
import fltk
import matplotlib
matplotlib.use('FltkAgg')
import pylab as p
import time
	
hf=p.figure()
ha=hf.add_subplot(1,1,1)
ha.plot([1,2,3])
p.draw()
time.sleep(5)
The problem I'm having is that if I execute these commands from a python
shell using:
execfile(filename)
(where filename is a file containing the above commands) then the figure
isn't being drawn until after sleep is executed. What I'd like is for
this function to just make the figure and leave it there while control
returns to the calling function. I can then create the plot from my
application(written in c) by linking with python and calling 'execfile'
where execfile contains the commands to make the plot.
I'm new to Python and appreciate any help.
Thanks.
Jeremy
From: Alan G I. <ala...@gm...> - 2009年05月20日 19:39:11
On 5/18/2009 6:25 PM Yannick Copin apparently wrote:
> rowspan=2, colspan=3) should actually do. What would be the syntax for 
> the following layouts?
>
> +-----+-----+
> | | ax2 |
> | ax1 +-----+
> | | ax3 |
> +-----+-----+
subplot2grid(shape=(2,2), loc=(0,0), rowspan=2)
subplot2grid(shape=(2,2), loc=(0,1))
subplot2grid(shape=(2,2), loc=(1,1))
> +-------+---+
> | | |
> | ax1 |ax3|
> | | |
> +-------+---+
> | ax2 |
> +-----------+
subplot2grid(shape=(3,3), loc=(0,0), rowspan=2, colspan=2)
subplot2grid(shape=(3,3), loc=(0,2), rowspan=2)
subplot2grid(shape=(3,3), loc=(2,0), colspan=3)
Again, consider the tkinter grid manager.
hth,
Alan Isaac
From: Markus H. <mar...@st...> - 2009年05月20日 19:01:02
Am Mittwoch, den 20.05.2009, 10:21 -0500 schrieb Ryan May:
> 
> Except that it won't work like that. :) (I actually tried that the
> first time) You need to give Figure.colorbar() the mappable as the
> first argument. So this would then become:
> 
> ax1 = fig.add_subplot(231,aspect='equal')
> pc = ax1.pcolor(xsr)
> ax1.axis([0, 127, 0, 127])
> fig.colorbar(pc)
Yep, that's it. It works now. Thank you for your help,
Cheers,
Markus
From: Markus H. <mar...@st...> - 2009年05月20日 15:22:58
Thank you very much for your detailed explanations. When I try
plot1 = fig.add_subplot(231,aspect='equal')
plot1.pcolor(xsr)
plot1.axis([0, 127, 0, 127])
plt.colorbar()
I get the error message
AttributeError: 'NoneType' object has no attribute 'autoscale_None'
WARNING: Failure executing file: <test.py>
But I don't really know, what this means.
> It may be a good idea and refer to the return value of fig.add_subplot
> as "ax" or something that, rather than "plot1" because add_subplot
> returns an Axes instance and thus ax is a better mnemonic; see
> 
Thank you very much, I was not aware of that. However, if I try
fig = plt.figure()
ax1 = fig.add_subplot(231,aspect='equal')
ax1.pcolor(xsr)
ax1.axis([0, 127, 0, 127])
fig.colorbar()
I also get an error message:
TypeError: colorbar() takes at least 2 arguments (1 given)
WARNING: Failure executing file: <test.py>
Cheers,
Markus
From: Ryan M. <rm...@gm...> - 2009年05月20日 15:22:15
On Wed, May 20, 2009 at 10:04 AM, John Hunter <jd...@gm...> wrote:
> On Wed, May 20, 2009 at 9:53 AM, Ryan May <rm...@gm...> wrote:
>
> > Thanks for the full example, but if you carefully read the exception, it
> was
> > telling you the problem. :) plot1 here is an axes object, which does not
> > have a colorbar() method. Instead, you should change that to:
> >
> > plt.colorbar()
> >
> > Assuming everything else was working, you should be good to go with this
> > change.
> >
>
> It looks like Markus is trying to use the API, so rather than suggest
> the pyplot colorbar method, I suggest using the figure instance
> method. Markus the pyplot method plt.colorbar is a thin wrapper
> around the figure method fig.colorbar -- see also:
>
>
> http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
>
>
> http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.colorbar
>
> It may be a good idea and refer to the return value of fig.add_subplot
> as "ax" or something that, rather than "plot1" because add_subplot
> returns an Axes instance and thus ax is a better mnemonic; see
>
>
> http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.add_subplot
>
> So I suggest something like::
>
> fig = plt.figure()
>
> ax1 = fig.add_subplot(231,aspect='equal')
> ax1.pcolor(xsr)
> ax1.axis([0, 127, 0, 127])
> fig.colorbar()
Except that it won't work like that. :) (I actually tried that the first
time) You need to give Figure.colorbar() the mappable as the first
argument. So this would then become:
 ax1 = fig.add_subplot(231,aspect='equal')
 pc = ax1.pcolor(xsr)
 ax1.axis([0, 127, 0, 127])
 fig.colorbar(pc)
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: John H. <jd...@gm...> - 2009年05月20日 15:04:46
On Wed, May 20, 2009 at 9:53 AM, Ryan May <rm...@gm...> wrote:
> Thanks for the full example, but if you carefully read the exception, it was
> telling you the problem. :) plot1 here is an axes object, which does not
> have a colorbar() method. Instead, you should change that to:
>
> plt.colorbar()
>
> Assuming everything else was working, you should be good to go with this
> change.
>
It looks like Markus is trying to use the API, so rather than suggest
the pyplot colorbar method, I suggest using the figure instance
method. Markus the pyplot method plt.colorbar is a thin wrapper
around the figure method fig.colorbar -- see also:
 http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
 http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.colorbar
It may be a good idea and refer to the return value of fig.add_subplot
as "ax" or something that, rather than "plot1" because add_subplot
returns an Axes instance and thus ax is a better mnemonic; see
 http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.add_subplot
So I suggest something like::
 fig = plt.figure()
 ax1 = fig.add_subplot(231,aspect='equal')
 ax1.pcolor(xsr)
 ax1.axis([0, 127, 0, 127])
 fig.colorbar()
JDH
From: Ryan M. <rm...@gm...> - 2009年05月20日 14:53:38
On Wed, May 20, 2009 at 3:17 AM, marcusantonius <
mar...@st...> wrote:
>
> Hi everybody,
> I have the problem, that I cannot add a color bar to a pcolor plot, which I
> generate of some Data files. If I do
> fig = plt.figure()
>
> plot1 = fig.add_subplot(231,aspect='equal')
> plot1.pcolor(xsr)
> plot1.axis([0, 127, 0, 127])
> plot1.colorbar()
>
> it just gives me
> AttributeError: 'AxesSubplot' object has no attribute 'colorbar'
> WARNING: Failure executing file: <test.py>
>
> What am I doing wrong? At the end of this file you find the whole plot-file
Thanks for the full example, but if you carefully read the exception, it was
telling you the problem. :) plot1 here is an axes object, which does not
have a colorbar() method. Instead, you should change that to:
plt.colorbar()
Assuming everything else was working, you should be good to go with this
change.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: marcusantonius <mar...@st...> - 2009年05月20日 08:17:30
Hi everybody, 
I have the problem, that I cannot add a color bar to a pcolor plot, which I
generate of some Data files. If I do
fig = plt.figure()
plot1 = fig.add_subplot(231,aspect='equal')
plot1.pcolor(xsr)
plot1.axis([0, 127, 0, 127])
plot1.colorbar()
it just gives me
AttributeError: 'AxesSubplot' object has no attribute 'colorbar'
WARNING: Failure executing file: <test.py>
What am I doing wrong? At the end of this file you find the whole plot-file
Thank you for your help,
Markus
#!usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
# Open files
file1 = open('../physical/x-ray/193XM_phys.am', 'rb')
file1.seek(-131072,2) 
xm=np.fromfile(file1,dtype='>d')
file1.close()
file2 = open('../physical/x-ray/193XSB_phys.am', 'rb')
file2.seek(-131072,2)
xs=np.fromfile(file2,dtype='>d')
file2.close()
file3 = open('../physical/x-ray/193XT_phys.am', 'rb')
file3.seek(-131072,2)
xt=np.fromfile(file3,dtype='>d')
file3.close()
xsr=np.transpose(np.reshape(xs,(128,128)))
xtr=np.transpose(np.reshape(xt,(128,128)))
xmr=np.transpose(np.reshape(xm,(128,128)))
ind_xmax=np.where(xsr==np.max(xsr))[1][0]
ind_ymax=np.where(xsr==np.max(xsr))[0][0]
profil_xsr=np.zeros(np.minimum(ind_xmax,ind_ymax))
profil_xtr=np.zeros(np.minimum(ind_xmax,ind_ymax))
profil_xmr=np.zeros(np.minimum(ind_xmax,ind_ymax))
anzahl_gridpunkte=np.zeros(np.minimum(ind_xmax,ind_ymax))
for k in range(0,26):
 # Schleife über alle Gitterzellen
 for i in range(128):
	for j in range (128):
	 if (k)**2 < (i-ind_ymax)**2+(j-ind_xmax)**2 <= (k+1)**2:
		profil_xsr[k]=profil_xsr[k]+xsr[i][j]
		profil_xtr[k]=profil_xtr[k]+xtr[i][j]
		profil_xmr[k]=profil_xmr[k]+xmr[i][j]
		anzahl_gridpunkte[k]=anzahl_gridpunkte[k]+1
profil_xsr=profil_xsr/anzahl_gridpunkte
profil_xtr=profil_xtr/anzahl_gridpunkte
profil_xmr=profil_xmr/anzahl_gridpunkte
 
fig = plt.figure()
plot1 = fig.add_subplot(231,aspect='equal')
plot1.pcolor(xsr)
plot1.axis([0, 127, 0, 127])
plot1.colorbar()
plot2 = fig.add_subplot(232,aspect='equal')
plot2.pcolor(10**xtr)
plot2.axis([1, 128, 1, 128])
plot3 = fig.add_subplot(233,aspect='equal')
plot3.pcolor(xmr,vmin=0.0,vmax=0.5)
plot3.axis([1, 128, 1, 128])
plot4 = fig.add_subplot(234)
plot4.plot(profil_xsr)
plot4.axis(ymin=0, ymax=10)
plot5 = fig.add_subplot(235)
plot5.plot(profil_xtr)
plot5.axis(ymin=0, ymax=10)
plot6 = fig.add_subplot(236)
plot6.plot(profil_xmr)
plot6.axis([0, 25,0, 1])
fig.show()
-- 
View this message in context: http://www.nabble.com/Colorbar-for-pcolor-plot-tp23631013p23631013.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: guillaume r. <gra...@wy...> - 2009年05月20日 07:15:00
Christopher Barker wrote:
> John Hunter wrote:
>> You cannot import pylab or pyplot is you are embedding mpl in wx
>> (totally unsupported and expected to fail) -- you need to follow the
>> patterns in
>>
>> http://matplotlib.sourceforge.net/examples/user_interfaces/index.html
> 
> or use wxMPL:
> 
> http://agni.phys.iit.edu/~kmcivor/wxmpl/
> 
> 
> -Chris
> 
> 
I feel like I could have found out by myself xD
thanks !
----
This message contains confidential information and may contain information that is legally privileged. If you have received this message by mistake, please immediately notify us and delete the original message. Thank you. 
Ce message contient des informations confidentielles. S'il vous est parvenu par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire aucun usage et de n'en garder aucune copie.
----
From: Eric F. <ef...@ha...> - 2009年05月19日 21:22:28
Christopher Barker wrote:
> Christopher Barker wrote:
>>> If you are not running from svn, a workaround may be to specify the 
>>> angles as an ndarray or masked array with the shape set to (N,1) where N 
>>> is the number of arrows.
>> Yes, that seems to work. Thanks!
> 
> However, I'm a bit confused now -- if I specify the angles explicitly, 
> how do I specify the lengths of the arrows? The docs aren't clear on 
> this point:
> 
> *angles*: ['uv' | 'xy' | array]
> With the default 'uv', the arrow aspect ratio is 1, so that
> if *U*==*V* the angle of the arrow on the plot is 45 degrees
> CCW from the *x*-axis.
> With 'xy', the arrow points from (x,y) to (x+u, y+v).
> Alternatively, arbitrary angles may be specified as an array
> of values in degrees, CCW from the *x*-axis.
> 
> does it use sqrt(x^2+y^2) as the length?
no, it is always sqrt(u^2+v^2), which then gets scaled according to the 
"units" setting together with the "scale" setting.
> 
> Also:
> 
> *units*: ['width' | 'height' | 'dots' | 'inches' | 'x' | 'y' ]
> arrow units; the arrow dimensions *except for length* are in
> multiples of this unit.
> 
> * 'x' or 'y': *X* or *Y* data units
> 
> The arrows scale differently depending on the units. For
> 'x' or 'y', the arrows get larger as one zooms in;
> 
> which makes it sound like when you set "units" to 'x' or 'y' that the 
> length does get set to those units...
Correct.
> 
> What I'd like to be able to do is set the angles with "angles" and set 
> the length in y units, but i can't figure out how to do that.
quiver(times, np.zeros((len(times),)), lengths, np.zeros(len(lengths)), 
angles=angles, units='y', scale=scale)
Something like that should do it. I am assuming you are plotting time 
series. Of course, lengths and times must be the same length (where I 
am assuming they are 1-D). I'm also assuming your data are coming as 
lengths and angles, not as components.
Eric
> 
> Thanks,
> -Chris
> 
> 
> 
From: John H. <jd...@gm...> - 2009年05月19日 19:40:36
On Tue, May 19, 2009 at 2:33 PM, David Anderson <zer...@gm...> wrote:
> Nice, and thanks, I'm making the charts just to my own purposes, and hopelly
> use it as my Graduation ending job (I don't know ow to say this in english,
> basically is the app that you deliver before getting the degree), and I wish
> to improve the api, by now this is the best api to plot financial charts in
> python, do you know any better? I Want to make something like the
> www.advfn.com, but leave to the user to add it's own studies. I am
> brazilian, and yahoo finances don't give historical quotes for my country,
> I'll have to adapt to get the quotes from a bunch of csv files. Can you
> suggest anything to me? =) Thanks!
I don't know a better package for plotting financial data -- mpl works
just fine. It's just that the API for the matplotlib.finance module
could be better. I would prefer something designed around record
arrays with attrs 'date', 'open', 'high', 'low', 'close', 'volume'.
Take a look at the examples I pointed you to - some of them make
financial graphs w/o using the finance module.
As for CSV files, take a look at matplotlib.mlab.csv2rec (see also the
examples at)
http://matplotlib.sourceforge.net/search.html?q=codex+csv2rec
JDH
From: Christopher B. <Chr...@no...> - 2009年05月19日 19:38:37
Christopher Barker wrote:
>> If you are not running from svn, a workaround may be to specify the 
>> angles as an ndarray or masked array with the shape set to (N,1) where N 
>> is the number of arrows.
> 
> Yes, that seems to work. Thanks!
However, I'm a bit confused now -- if I specify the angles explicitly, 
how do I specify the lengths of the arrows? The docs aren't clear on 
this point:
 *angles*: ['uv' | 'xy' | array]
 With the default 'uv', the arrow aspect ratio is 1, so that
 if *U*==*V* the angle of the arrow on the plot is 45 degrees
 CCW from the *x*-axis.
 With 'xy', the arrow points from (x,y) to (x+u, y+v).
 Alternatively, arbitrary angles may be specified as an array
 of values in degrees, CCW from the *x*-axis.
does it use sqrt(x^2+y^2) as the length?
Also:
 *units*: ['width' | 'height' | 'dots' | 'inches' | 'x' | 'y' ]
 arrow units; the arrow dimensions *except for length* are in
 multiples of this unit.
 * 'x' or 'y': *X* or *Y* data units
 The arrows scale differently depending on the units. For
 'x' or 'y', the arrows get larger as one zooms in;
which makes it sound like when you set "units" to 'x' or 'y' that the 
length does get set to those units...
What I'd like to be able to do is set the angles with "angles" and set 
the length in y units, but i can't figure out how to do that.
Thanks,
-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: David A. <zer...@gm...> - 2009年05月19日 19:34:03
Nice, and thanks, I'm making the charts just to my own purposes, and hopelly
use it as my Graduation ending job (I don't know ow to say this in english,
basically is the app that you deliver before getting the degree), and I wish
to improve the api, by now this is the best api to plot financial charts in
python, do you know any better? I Want to make something like the
www.advfn.com, but leave to the user to add it's own studies. I am
brazilian, and yahoo finances don't give historical quotes for my country,
I'll have to adapt to get the quotes from a bunch of csv files. Can you
suggest anything to me? =) Thanks!
On Tue, May 19, 2009 at 4:21 PM, John Hunter <jd...@gm...> wrote:
> On Tue, May 19, 2009 at 2:09 PM, David Anderson <zer...@gm...>
> wrote:
> > In the documentation page there's no info about .finance, even looking on
> > the search tool I couldn't find anything:
> >
> http://matplotlib.sourceforge.net/search.html?q=finance&check_keywords=yes&area=default
> >
> > About the code, I found it =)
>
> I wrote the finance module a long time ago to make some basic
> financial charts, but I haven't updated it and I don't think it is the
> best way to go. But when I wrote it I wasn't in the financial
> industry and now I am so maybe my standards are higher :-)
>
> You can get help from matplotlib.finance -- we haven't uploaded all
> the module docs to the site documentation yet because there are some
> formatting issues with the docstrings nad we are doing them as we get
> to them. In the meantime, use the ipython shell
>
> import matplotlib.finance
> help matplotlib.finance
>
> Also, see the code examples
>
> http://matplotlib.sourceforge.net/search.html?q=finance+codex
>
> JDH
>
-- 
David Anderson Lino de Sousa
Undergraduate in Computer Science -
http://ccc.ufcg.edu.br/index.php/Main_Page
Embedded Systems and Pervasive Computing Lab - http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br
From: John H. <jd...@gm...> - 2009年05月19日 19:21:53
On Tue, May 19, 2009 at 2:09 PM, David Anderson <zer...@gm...> wrote:
> In the documentation page there's no info about .finance, even looking on
> the search tool I couldn't find anything:
> http://matplotlib.sourceforge.net/search.html?q=finance&check_keywords=yes&area=default
>
> About the code, I found it =)
I wrote the finance module a long time ago to make some basic
financial charts, but I haven't updated it and I don't think it is the
best way to go. But when I wrote it I wasn't in the financial
industry and now I am so maybe my standards are higher :-)
 You can get help from matplotlib.finance -- we haven't uploaded all
the module docs to the site documentation yet because there are some
formatting issues with the docstrings nad we are doing them as we get
to them. In the meantime, use the ipython shell
 import matplotlib.finance
 help matplotlib.finance
Also, see the code examples
 http://matplotlib.sourceforge.net/search.html?q=finance+codex
JDH
From: David A. <zer...@gm...> - 2009年05月19日 19:09:40
In the documentation page there's no info about .finance, even looking on
the search tool I couldn't find anything:
http://matplotlib.sourceforge.net/search.html?q=finance&check_keywords=yes&area=default
About the code, I found it =)
On Tue, May 19, 2009 at 4:05 PM, Ryan May <rm...@gm...> wrote:
> On Tue, May 19, 2009 at 1:33 PM, David Anderson <zer...@gm...>wrote:
>
>> Hi, I've seen some examples with it, but I couldn't find any docs about
>> it, Is there any? If not Where Can I get the source code for it to take a
>> look?
>> Another thing, what about this example:
>> http://matplotlib.sourceforge.net/examples/pylab_examples/plotfile_demo.htmlWhere can I get the csv files used on it ?
>> Thanks!
>
>
> Welcome! Not to be too blunt, but if you click on the "documentation" link
> on page you gave, you'd get a link here, which is the main documentation
> page: http://matplotlib.sourceforge.net/contents.html
>
> Also, you can take the page you gave and click on the "matplotlib home"
> link, you'd see you can get the source here:
> http://sourceforge.net/projects/matplotlib
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States
-- 
David Anderson Lino de Sousa
Undergraduate in Computer Science -
http://ccc.ufcg.edu.br/index.php/Main_Page
Embedded Systems and Pervasive Computing Lab - http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br
22 messages has been excluded from this view by a project administrator.

Showing results of 523

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