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

Showing results of 36569

<< < 1 .. 1455 1456 1457 1458 1459 .. 1463 > >> (Page 1457 of 1463)
From: Eugene A. S. <Cit...@in...> - 2003年12月26日 09:45:14
Hi all!
There are some bug's I've found in two days I got started with echotag.
1) I can't make 2 plots using WX-backend sequentially
For example:
---CODE---
import matplotlib
matplotlib.use('WX')
from matplotlib.matlab import *
plot([1,2,3,4])
show()
plot([1,4,9,16])
show()
--END CODE--
Well, everything is OK, while building 1st graph, but then an error
occurs:
--OUTPUT--
Traceback (most recent call last):
 File "plot.py", line 7, in ?
 plot([1,4,9,16])
 File "/usr/lib/python2.2/site-packages/matplotlib/matlab.py", line
723, in plot draw_if_interactive()
 File
"/usr/lib/python2.2/site-packages/matplotlib/backends/backend_wx.py",
line 986, in draw_if_interactive current_fig =
Gcf().get_current_figwin().figure AttributeError: 'Gcf' object has no
attribute 'get_current_figwin'
--END OUTPUT--
It was tested on Linux and Windows. Versions 0.40 and 0.32
When I'm using GTK everything is OK with both graphs, but using WX is
critical :(
2) matplotlib-0.40:
When I'm performing smth like: 
tl=get_xticklabels(...)
for l in tl:
	print get_text(l)
I'm wondering why tl is a correct list, but with empty text :(
Version 0.32 is OK
P.S. 
Sorry for my bad english
-- 
Best regards
Eugene A. Suchkov
***************************
* ICQ:177787156 *
* JID: cit...@ja... *
***************************
 
From: Charles R. T. <cha...@in...> - 2003年12月18日 17:20:00
JH> 2) The http://www.forkosh.com/mimetex.html license is GPL, which in
JH> my understanding is not really compatible with the PSF license.
You can always write them and ask for another license.
	-crt
From: John H. <jdh...@ac...> - 2003年12月18日 13:23:53
>>>>> "Flavio" == Flavio C Coelho <fcc...@fi...> writes:
 Flavio> Hi John, I know that you are probably already overwhelmed
 Flavio> by maintenance and developmente of this great package, but
 Flavio> I came across a post on the mod_python list in which a
 Flavio> person was inquiring about the existance of a plotting
 Flavio> package for mod_python since mod_PHP and mod_Perl have
 Flavio> theirs. I thought that this could be a great thing to add
 Flavio> to matplotlib: a mod_python backend. It would be awesome
 Flavio> if we could have scientific python applets that could
 Flavio> generate full graphical output on the web.
 Flavio> It shouldn't be too hard to do since it could use any of
 Flavio> the existing backends and just export the resulting figure
 Flavio> to mod_python to embed in a web page...
 Flavio> what do you think?
I am currently using matplotlib as a plotting backend for a web
server. I'm working with a PHP developer who is writing the html, and
he calls an XML-RPC python server with the parameters for the plot.
The XML-RPC server does some number crunching, generates a plot with
matplotlib, saves it in a tmp dir, and passes the image filename back
to the PHP client. I'm using the GTK backend running in an Xvfb.
I don't know much about apache, or what is involved in making
something for mod_python. You wouldn't really need a 'mod_python
backend' would you? My guess is that you would just need to import
matplotlib into your mod_python python code, for example using the GD
backend, and plot away. Or is there something more to it? 
Do you know if you can use mod_python and mod_php together? Can
functions written in one mod_* language communicate with functions
written in another. My guess is not.... It would be great if I could
use mod_python and my front end person uses mod_php, and we could
communicate within apache w/o going through the XML-RPC server.
John Hunter 
From: John H. <jdh...@ac...> - 2003年12月17日 03:39:33
>>>>> "Flavio" == Flavio C Coelho <fcc...@fi...> writes:
 Flavio> Hi John, I followed a discussion on the list a while ago,
 Flavio> where some suggestions were made as to how math
 Flavio> typesetting could be added to th plots. I don't know if
 Flavio> you have already made up your mind about how this should
 Flavio> be done in matplotlib, but I recently came across a good
 Flavio> and very light solution for typesetting equations from
 Flavio> latex code without having to use tex/latex in any way.
 Flavio> Its a small ansi C program called mimetex that generates a
 Flavio> bitmap directly from latex code. I have been using it as a
 Flavio> cgi for typesetting equations from latex code embedded in
 Flavio> html, and I am very happy with it. Take a look at its
 Flavio> website: http://www.forkosh.com/mimetex.html
Hi Flavio,
Thanks for the pointer - I'll definitely keep it in mind. I have two
reservations
 1) bitmap output might be hard to support across the various
 backends, eg, postscript. This limitation is probably not fatal,
 though, since postscript can instead use native TeX output. I've
 been meaning to take a closer look at pyx -
 http://pyx.sourceforge.net - which has very nice postscript / TeX
 integration, to see how they pull it off. Even if TeX / LaTeX
 were only supported in one matplotlib backend that would be better
 than none.
 2) The http://www.forkosh.com/mimetex.html license is GPL, which in
 my understanding is not really compatible with the PSF license.
 Ie, the python license (like the BSD, MIT and related licenses)
 permits more or less *any* non-warranted use of the code,
 including proprietary / closed source. matplotlib is released
 under the PSF license. GPL requires that code that uses it to
 also be open source / free software. I have not thought about
 this deeply, or consulted a lawyer, so this is really just my
 impression after a somewhat cursory investigation, but it's a
 consideration. Licensing gurus please weigh in here....
But these considerations aside, it's a very good suggestion. At the
least, it would be nice to have it as a backend dependent optional
addon. I've wanted to have the ability to plot an image in an axes
for some time (something like matlab's imshow). If this functionality
existed, it would be relatively easy to plug the mimetex bitmaps into
it. 
JDH
From: Sajec, M. T. <ms...@tq...> - 2003年12月17日 00:00:07
Is it possible to use the wx backend interactively with a wx based shell?
And If so, is there any documentation on how to do so?
Thnx,
-Mike
From: Christopher F. <ch...@fo...> - 2003年12月16日 21:33:07
Whenever I run a program that imports matplotlib, it requests pythonw 
rather than python. Here's the message:
This program needs access to the screen. Please run with
'pythonw', not 'python', and only when you are logged in on the main 
display
of your Mac.
Is there any way of getting around this? In particular, when I am 
running python remotely on the terminal, it will not let me use 
matplotlib since access to the screen is required. However, I would 
like to be able to generate plots to file (remotely) without ever 
showing them on the screen. Is there something I need to set in order 
to satisfy this?
Thanks,
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
From: John H. <jdh...@ac...> - 2003年12月16日 13:48:37
>>>>> "Flavio" == Flavio C Coelho <fcc...@fi...> writes:
 Flavio> John, is there a way, in matplotlib, to emulate the
 Flavio> behavior of the matlab "hold" comand to plot multiple
 Flavio> datasets on a single figure?
The default behavior in matplotlib is 'hold on'.
Eg, 
 plot(x1, y1)
 plot(x2, y2)
Both plot to the same figure.
This is one way in which matplotlib differs from matlab.
From: K.KISHIMOTO <ko...@us...> - 2003年12月16日 12:48:07
Thanks for your quick reply.
On 2003年12月16日, at 20:47 Japan, John Hunter wrote:
> Is this what you mean?
More precisely, what I mean is like the top-left plot in 
http://www.slac.stanford.edu/grp/ek/hippodraw/canvaswindow.png
If I understand bar() (then hist()) functionalities correctly, it may 
be unable to create such a plot currently without using plot().
from matplotlib.matlab import *
bins = [0, 1, 2, 3]
vals = [3, 4, 5]
x = [bins[0]]
y = [0]
vals.append(0)
for i in range(len(bins) - 1):
 x.append(bins[i])
 y.append(vals[i])
 x.append(bins[i + 1])
 y.append(vals[i])
 x.append(bins[i + 1])
 y.append(vals[i + 1])
plot(x, y)
show()
From: John H. <jdh...@ac...> - 2003年12月16日 11:55:06
>>>>> "K" == K KISHIMOTO <ko...@us...> writes:
 K> If possible, I think it is nice for matplotlib to be able to
 K> plot histograms by not only bars but also lines. My meaning of
 K> "bar histogram plotting" is like the bottom-left plot in
 K> http://jas.freehep.org/images/screenshots/gui2.gif and "line
 K> histogram plotting" is like the others. There are two reasons.
If I understand you correctly, and from looking at the images you
linked to, all you need to do is set the edge and face properties of
the bars to the same color. The default edge color is black and the
default face color is blue, so if you want a solid histogram do
 from matplotlib.matlab import *
 mu, sigma = 100, 15
 x = mu + sigma*randn(10000)
 n, bins, patches = hist(x, 200, normed=1)
 set(patches, 'edgecolor', 'b')
 show()
Is this what you mean?
 K> Off course, the bar histogram plotting is more smart in one
 K> case, but in another case the line is better. In addition, the
 K> support of both bar and line histogram plotting will matplotlib
 K> to be able to have more plotting features that the colors of
 K> line and filled area can be specified separately by the user.
The axes function 'vlines' plots vertical lines. See the
example/vline_demo.py
Cheers,
John Hunter
From: K.KISHIMOTO <ko...@us...> - 2003年12月16日 08:36:09
Hi,
On 2003年12月15日, at 23:09 Japan, John Hunter wrote:
> OK, I'll give it some thought. Sounds reasonable enough. It doesn't
> break backwards compatibility, adds useful features, and is more
> consistent with bar.
Thank you so much!
If possible, I think it is nice for matplotlib to be able to plot 
histograms by not only bars but also lines.
My meaning of "bar histogram plotting" is like the bottom-left plot in 
http://jas.freehep.org/images/screenshots/gui2.gif and "line histogram 
plotting" is like the others.
There are two reasons.
(1) Because one bin width becomes a few pixcels, it is hard to see when 
the number of bins is about a few thousand in the bar histogram 
plotting mode.
(2) The color of all of the data filled area become the same by using 
bar and one can specify the line color separately. This brings smart 
view when multiple histograms are plotted like in 
http://root.cern.ch/root/html/examples/gif/hsum.gif
Off course, the bar histogram plotting is more smart in one case, but 
in another case the line is better.
In addition, the support of both bar and line histogram plotting will 
matplotlib to be able to have more plotting features that the colors of 
line and filled area can be specified separately by the user.
It seems that it is relatively not difficult to implement the feature 
by connecting points of [(x0, 0), (x0, y0), (x1, y0), (x1, y1), (x2, 
y1), (x2, y2), ...(and so on)] and will also not break backwards 
compatibility.
If possible, please give a consideration to this.
>>>>>> "K" == K KISHIMOTO <ko...@us...> writes:
>
> K> I am sorry that my last explanation was insufficient. The
> K> point is that I think it is inefficient to execute the
> K> following two lines in matplotlib.mlab.hist when I know the
> K> result of "n" already.
>
> Good point ...
>
> K> Another point is hist() does not support error bar plot (but
> K> bar() called from hist() does support.)
>
> Another good point....
>
> K> So, I propose again def hist(x, bins=10, noplot=0, normed=0,
> K> weights=None, errors=None , **kwargs): in matplotlib.matplab.
> K> I think if matplotlib supports this by default, it is very
> K> smart and usefull to many users when making histogram plots
> K> with matplotlib than letting hist() be mainly for the purpose
> K> of "calculating" histograms.
>
> OK, I'll give it some thought. Sounds reasonable enough. It doesn't
> break backwards compatibility, adds useful features, and is more
> consistent with bar.
>
> JDH
>
From: John H. <jdh...@ac...> - 2003年12月15日 22:42:53
>>>>> "Christopher" == Christopher Fonnesbeck <ch...@fo...> writes:
 Christopher> ... I'm not sure why I'd want to use gtk instead of
 Christopher> wx anyhow, given the choice.
One more option. If all you want is the batch generation of figures
offline with no display, you can use either the PS or GD backends. PS
only requires Numeric. gd, however, takes some energy to build.
But it works: I just built all the prereqs on OSX from source and it
worked perfectly.
You need
libjpeg - http://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz
 ./configure
 sudo make
 sudo cp libjpeg.a /usr/local/lib/
 sudo cp *.h /usr/local/include/
libpng - http://umn.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.5.tar.gz
 cp scripts/makefile.macosx Makefile
 sudo make install
You then need to follow the build instructions for gd, gdmodule and
dependencies at
http://matplotlib.sourceforge.net/backends.html#GD
Here's an example script ....
import matplotlib
matplotlib.use('GD')
from matplotlib.matlab import *
t = arange(0.0, 3.0, 0.01)
for i in range(1,10):
 figure(1)
 s = sin(2*pi*i*t)
 plot(t,s)
 savefig('plot%02d' % i)
 close(1)
I put all this here mainly for archival purposes in case someone wants
to use matplotlib / OSX / gdmodule. We'll get the wx thing figured
out too ....
JDH
From: John H. <jdh...@ac...> - 2003年12月15日 21:40:47
>>>>> "Christopher" == Christopher Fonnesbeck <ch...@fo...> writes:
 Christopher> ... I'm not sure why I'd want to use gtk instead of
 Christopher> wx anyhow, given the choice.
No compelling reason. The GTK backend was the first and probably the
most stable for that reason. This is the first release with the wx
backend, so there are likely some bugs lurking that will have to be
found and stamped out.
 Christopher> I'm trying to keep my plotting in a separate module
 Christopher> from everything else, so that I don't have to make
 Christopher> changes all over the place when I change my plotting
 Christopher> code. For example, plot_histogram() can be called
 Christopher> from any other module without knowing how the plot is
 Christopher> implemented. If I have to call show() from each
 Christopher> module that uses the plotting module, it will start
 Christopher> to get messy. Outside of the Plot module, the rest of
 Christopher> my code shouldn't have to know anything about
 Christopher> matplotlib. So, I'd like to be able to gererate and
 Christopher> save a plot, then move on to the next piece of
 Christopher> code. I'm trying to use your package in place of
 Christopher> scipy, which is what I have been using to generate
 Christopher> plots up until now; hopefully I can make it work.
Would you like this to run 'offline' so that no windows pop up as you
create the figures, or is it enough simply that you can create them
one at a time in batch mode with the plot functionality encapsulated?
I just installed wxpython and matplotlib on OS X, so I'll have a
chance to delve into this issue a bit....
John Hunter
From: Christopher F. <ch...@fo...> - 2003年12月15日 21:13:55
On Dec 15, 2003, at 3:29 PM, John Hunter wrote:
>
>
> Christopher> I'm trying to use matplotlib on OSX (so with WX
> Christopher> rather than gtk) in conjunction with my own code that
>
> Not necessarily. pygtk, gtk-2, etc... have been packaged for fink.
> I'm going to try and install them on my powerbook when I get a few
> minutes.
I like to avoid fink unless I absolutely have to use it -- it ends up 
installing a whole bunch of packages that I already have elsewhere on 
my machine, thereby creating the need to maintain multiple 
installations of the same package.
... I'm not sure why I'd want to use gtk instead of wx anyhow, given 
the choice.
>
> show must be the last line of your script. Is it possible to do all
> the figures in the loop and then call show? If your number of figures
> is very large, you could run into memory problems this way. There is
> a work-around, but if you can do it all in memory that is the easiest
> solution
>
> for i in range(1,10):
> figure(i)
> # do plot i
> savefig('plot%d'%i)
> show()
>
> This is an area that I am actively working on (in fact I was working
> on it when you emailed!) so if this isn't a viable solution for you
> let me know. I'm implementing some features to make it easier to use
> matplotlib in with xvfb (virtual x) so you can produce plots in wx or
> gtk without launching the GUI windows.
>
>
I'm trying to keep my plotting in a separate module from everything 
else, so that I don't have to make changes all over the place when I 
change my plotting code. For example, plot_histogram() can be called 
from any other module without knowing how the plot is implemented. If I 
have to call show() from each module that uses the plotting module, it 
will start to get messy. Outside of the Plot module, the rest of my 
code shouldn't have to know anything about matplotlib. So, I'd like to 
be able to gererate and save a plot, then move on to the next piece of 
code. I'm trying to use your package in place of scipy, which is what I 
have been using to generate plots up until now; hopefully I can make it 
work.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
From: John H. <jdh...@ac...> - 2003年12月15日 21:07:06
>>>>> "Christopher" == Christopher Fonnesbeck <ch...@fo...> writes:
 Christopher> code for some reason, but instead hangs. When I try
 Christopher> and close the plot manually, it terminates the python
 Christopher> code. How can I get matplotlib to produce a new plot
 Christopher> each time it is called, moving on after each plot is
 Christopher> produced, displayed and saved to file. Here is a
 Christopher> sample function from my code:
For the GTK backend, there is another solution. The call to 
ShowOn().set(1) tells matplotlib to execute the commands as they are
issued, which was originally designed for people using matplotlib
from the python shell but also applies to your case, where you want to
generate a bunch of figures one at a time
import matplotlib
matplotlib.use('GTK')
from matplotlib.matlab import *
from matplotlib.backends.backend_gtk import ShowOn
ShowOn().set(1) 
t = arange(0.0, 3.0, 0.01)
for i in range(1,10):
 figure(1)
 s = sin(2*pi*i*t)
 plot(t,s)
 savefig('plot%02d' % i)
 close(1)
*Note there is no call to show at the end*
The same trick *does not* currently work with the WX backend, though
perhaps Jeremy can take a look at it and determine why not. Somehow
the call the ShowOn().set(1) seems to screw it up.
We'll look into it...
JDH
From: John H. <jdh...@ac...> - 2003年12月15日 20:37:27
>>>>> "Christopher" == Christopher Fonnesbeck <ch...@fo...> writes:
 Christopher> First off, I want to congratulate the authors of
 Christopher> matplotlib for making a great package. This is the
 Christopher> python plotting library I've been waiting for.
Thanks!
 Christopher> I'm trying to use matplotlib on OSX (so with WX
 Christopher> rather than gtk) in conjunction with my own code that
Not necessarily. pygtk, gtk-2, etc... have been packaged for fink.
I'm going to try and install them on my powerbook when I get a few
minutes.
 Christopher> produces Markov chain Monte Carlo simulations. At the
 Christopher> end of the simulation, I try to plot traces and
 Christopher> histograms of all of the sampled values. However,
 Christopher> matplotlib gets stuck on the first plot. After
 Christopher> calling show(), it does not move to the next line of
 Christopher> code for some reason, but instead hangs. When I try
 Christopher> and close the plot manually, it terminates the python
 Christopher> code. How can I get matplotlib to produce a new plot
 Christopher> each time it is called, moving on after each plot is
 Christopher> produced, displayed and saved to file. Here is a
 Christopher> sample function from my code:
show must be the last line of your script. Is it possible to do all
the figures in the loop and then call show? If your number of figures
is very large, you could run into memory problems this way. There is
a work-around, but if you can do it all in memory that is the easiest
solution
for i in range(1,10):
 figure(i)
 # do plot i
 savefig('plot%d'%i)
show()
This is an area that I am actively working on (in fact I was working
on it when you emailed!) so if this isn't a viable solution for you
let me know. I'm implementing some features to make it easier to use
matplotlib in with xvfb (virtual x) so you can produce plots in wx or
gtk without launching the GUI windows.
JDH
From: Christopher F. <ch...@fo...> - 2003年12月15日 20:22:48
First off, I want to congratulate the authors of matplotlib for making 
a great package. This is the python plotting library I've been waiting 
for.
I'm trying to use matplotlib on OSX (so with WX rather than gtk) in 
conjunction with my own code that produces Markov chain Monte Carlo 
simulations. At the end of the simulation, I try to plot traces and 
histograms of all of the sampled values. However, matplotlib gets stuck 
on the first plot. After calling show(), it does not move to the next 
line of code for some reason, but instead hangs. When I try and close 
the plot manually, it terminates the python code. How can I get 
matplotlib to produce a new plot each time it is called, moving on 
after each plot is produced, displayed and saved to file. Here is a 
sample function from my code:
def 
plot_histogram(data,name,nbins=None,xlab='Value',ylab='Frequency',suffix 
=''):
	'Internal histogram specification for handling nested arrays'
	
	'If there is only one data array, go ahead and plot it ... '
	if len(shape(data))==1:
		print 'Generating histogram of',name
		try:
			figure(1)
			nbins = min(nbins or 10,len(unique(data)))
			'Generate histogram'
			hist(data,nbins)
			'Plot options'
			xlabel(name)
			ylabel("Frequency")
			show()
			'Save to file'
			savefig("%s%s.png" % (name,suffix))
			close(1)
		except OverflowError:
			print '... cannot generate histogram'
	else:
		'... otherwise, plot recursively'
		tdata = swapaxes(data,0,1)
		for i in range(len(tdata)):
Thanks for any advice,
C.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
From: John H. <jdh...@ac...> - 2003年12月15日 16:04:58
matplotlib is a pure python 2D plotting library with a matlab syntax
which produces publication quality figures using in a variety of
hardcopy formats (PNG, JPG, TIFF, PS) and interactive GUI environments
(WX, GTK) across platforms. matplotlib can be used in python scripts,
interactively from the python shell (ala matlab or mathematica), in
web application servers generating dynamic charts, or embedded in GTK
or WX applications.
 http://matplotlib.sourceforge.net
What's new
WX python backend
 Jeremy O'Donoghue has done an amazing job implementing the backend
 for wxpython, with all the features such as interactive navigation
 that are supported in the GTk backend. matplotlib should not be
 available with a GUI anywhere wxpython, Numeric and python work,
 including linux and friends, win32, and Mac OS X. See
 http://matplotlib.sourceforge.net/matplotlib.backends.backend_wx.html
 for a summary of known issues.
Pseudo color plots
 The pcolor command generates pseudo color plots. See
 http://matplotlib.sourceforge.net/screenshots.html#pcolor_demo and
 http://matplotlib.sourceforge.net/screenshots.html#mri_with_eeg for
 screenshots and example code
New time-series plotting functions
 
 * psd - plots the power spectral density of a time series
 * csd - plots the cross spectral density of two time series
 * cohere - plots the coherence
 See the examples dir in the src distro: psd_demo.py and csd_demo.py
Substantially improved layout
 The transform architecture was refactored, allowing much more
 precise layout. Lines, patches, text, etc... can now be placed and
 scaled in arbitrary units, relative axes units, or physical size.
 Applicaiton programmers who want to create lines, patches and text
 directly using the API should read the transform module docs for
 more info. See the text help for an example of how to specify text
 locations in axes coords (0,0 is lower left and 1,1 is upper right)
Expanded legend capabilities
 The legend class is improved, with a more sophisticated layout
 engine and the ability to accept lines and rectangle patches as an
 optional first argument to specify which lines/patches make up the
 legend. There are also additional legend placement locations, like
 'upper center'. See
 http://matplotlib.sourceforge.net/screenshots.html#legend_demo
Expanded errorbar capabilities
 Gary Ruben contributed some code to support x and y errorbars,
 either symmetrix or asymettric, in one enhanced function 'errorbar'.
 See the errorbar_demo.py for examples of all the wild and wonderful
 errorbar styles. Bar charts can now also display errorbars; see
 http://matplotlib.sourceforge.net/screenshots.html#barchart_demo
Figure size and DPI controllable from matlab interface
 The figure command now takes optional args figsize and dpi to set
 the figure size and DPI in the matlab interface. This change
 involved some changes in the way default sizes and resolutions were
 handled among the various backends, with the effect that figures
 generated by existing scripts may appear different, eg, in the
 relative size of text to the figure elements. The advantage is that
 the current implementation does a better job of computing true sizes
 with increased fidelity between backends. Apologies for any
 inconveniences!
API changes
 There have been some minor changes to the API for those using
 matplotlib embedded in GTK applications. 
 * If you instantiate an Axes of Subplot intace, the first arg to
 __init__ must be the figure that contains it.
 * If you instantiate any artists, eg, Line2D, Rectangle, or
 AxisTextGTk, you must initialize them with their dpi, bbox, and
 transforms. See the help for the transforms modules and the
 examples logo.py and mri_with_eeg.py, where the objects are
 explicity created using the new API.
 * The only change to the matlab interface is in the signature of the
 errorbar func, which breaks matlab compatibility for the enhanced
 ability to do x and y errorbars.
 * See matplotlib.axes.py for a complete list of API changes
John Hunter
From: John H. <jdh...@ac...> - 2003年12月15日 14:16:56
>>>>> "K" == K KISHIMOTO <ko...@us...> writes:
 K> I am sorry that my last explanation was insufficient. The
 K> point is that I think it is inefficient to execute the
 K> following two lines in matplotlib.mlab.hist when I know the
 K> result of "n" already.
Good point ...
 K> Another point is hist() does not support error bar plot (but
 K> bar() called from hist() does support.)
Another good point....
 K> So, I propose again def hist(x, bins=10, noplot=0, normed=0,
 K> weights=None, errors=None , **kwargs): in matplotlib.matplab.
 K> I think if matplotlib supports this by default, it is very
 K> smart and usefull to many users when making histogram plots
 K> with matplotlib than letting hist() be mainly for the purpose
 K> of "calculating" histograms.
OK, I'll give it some thought. Sounds reasonable enough. It doesn't
break backwards compatibility, adds useful features, and is more
consistent with bar.
JDH
From: K. K. <ko...@us...> - 2003年12月15日 13:38:29
Thank you for your reply.
> def func1(x=None):
> if x is None: x = []
> #blah blah
The indication is right.
I should have done so. Thank you.
> This seems like the kind of thing that would best be done in your user
> library. Eg, if you make a module mymatplotlib.py, you can defined
> your own hist. In that file, just import matplotlib.matlab and call
> matplotlib.matlab.hist within it. In fact, matplotlib.matlab.hist
> calls matplotlib.mlab.hist.
I am sorry that my last explanation was insufficient.
The point is that I think it is inefficient to execute the following 
two lines in matplotlib.mlab.hist when I know the result of "n" already.
 >> n = searchsorted(sort(y), bins)
 >> n = diff(concatenate([n, [len(y)]]))
For the moment, I must insert extra code
 >> y = [1.0] * 1000
(and hist(y, [0.0, 2.0]) calculates n = [1000], then plot the data.)
This is very expensive.
Another point is hist() does not support error bar plot (but bar() 
called from hist() does support.)
So, I propose again
def hist(x, bins=10, noplot=0, normed=0, weights=None, errors=None , 
**kwargs):
in matplotlib.matplab.
I think if matplotlib supports this by default, it is very smart and 
usefull to many users when making histogram plots with matplotlib than 
letting hist() be mainly for the purpose of "calculating" histograms.
Example rough code.
------
def hist(x, bins=10, noplot=0, normed=0, weights=None, xerr=None, 
yerr=None, **kwargs):
 if noplot:
 if weights == None:
 return mlab.hist(x, bins, normed)
 else:
 return (weights, bins)
 else:
 try:
 if weights == None:
 ret = gca().hist(x, bins, normed)
 else:
 ret = gca().bar(bins, weights, xerr=xerr, yerr=yerr, 
**kwargs)
 except ValueError, msg:
 msg = raise_msg_to_str(msg)
 error_msg(msg)
 raise RuntimeError, msg
 draw_if_interactive()
 return ret
From: John H. <jdh...@ac...> - 2003年12月12日 13:38:55
>>>>> "K" == K KISHIMOTO <ko...@us...> writes:
 K> Hi, I'm using matplotlib for my scientific analysis, and
 K> charmed by It's function.
Thanks!
 K> Because I often use another tools for data histograming, I
 K> think it's convenient if matplotlib could plot already
 K> histogramed data more efficiently.
This seems like the kind of thing that would best be done in your user
library. Eg, if you make a module mymatplotlib.py, you can defined
your own hist. In that file, just import matplotlib.matlab and call
matplotlib.matlab.hist within it. In fact, matplotlib.matlab.hist
calls matplotlib.mlab.hist.
On an unrelated topic: 
 def hist(x, bins=10, noplot=0, normed=0, weights=[], errors=[])
Just wanted to point out that this is a potential gotcha in python.
For example, what do you expect the output of this code to be?
def func1(x=[]):
 if not len(x): x.append(1)
 print x
 
def func2(y=[]):
 if len(y)<2: y.append(2)
 print y
z = []
func1(z)
func2(z)
The standard way to pass empty lists as default function args is to
do:
def func1(x=None):
 if x is None: x = []
 #blah blah 
Lists and dicts are different in this capacity than strings or ints
because the can be changed (mutable).
Thanks for your suggestions,
John Hunter
From: K.KISHIMOTO <ko...@us...> - 2003年12月12日 07:49:20
Hi,
I'm using matplotlib for my scientific analysis, and charmed by It's 
function.
Because I often use another tools for data histograming,
I think it's convenient if matplotlib could plot already histogramed 
data more efficiently.
For exmple, changing from
hist(x, bins=10, noplot=0, normed=0)
to
hist(x, bins=10, noplot=0, normed=0, weights=[], errors=[])
Calling
hist([0.5, 1.5, 1.7, 2.5], [0.0, 1.0, 3.0])
equals to
hist([0.5, 1.6, 2.5], [0.0, 1.0, 3.0], weights=[1.0, 2.0, 0.0])
or
hist([0.5, 1.6, 2.5], [0.0, 1.0, 3.0], weights=[1.0, 2.0, 0.0], 
errors=[1.0, 1.414, 0.0])
(1) When "weights" argument is provided, "x" is assumed as a list of 
weighted mean (or center) values of each bin and "weights" is assumed 
as a list of (already histogramed) weights of each bin.
(2) When "errors" argument is omitted, it's default values are set to 
the squares of weights.
(3) When "errors" argument is provided, it's values are used as a list 
of one-sigma errors of each bin.
Thank you for reading.
Koji
From: John H. <jdh...@ac...> - 2003年12月10日 05:10:16
>>>>> "Carlos" == Carlos <ra...@ho...> writes:
 Carlos> Hi whats a good way to add a file open dialog box to a
 Carlos> matplotlib script like the one in the demo called
 Carlos> "simple_plot.py". I'm new to python and am really
 Carlos> impressed with using matplotlib. Is there an EZ way to add
 Carlos> a file select dialog?
Yes.
If you are using the GTK backend, there are two examples in the
examples dir of the source distribution (*.zip or *.tar.gz) to help
you out.
 1) embedding_in_gtk2.py shows you how to use matplotlib in a GTK example.
 2) mpl_with_glade.glade and mpl_with_glade.py show you how to use
 matplotlib with gtk and glade. glade is a RAD (rapid application
 development) tool that allows you to design GUIs in a
 drag-and-drop environment.
To use either of these you'll still have to learn pygtk
http://www.daa.com.au/~james/pygtk/ and/or glade
http://glade.gnome.org.
If you want to use the wx backend, jeremy has provided an example of
how to use matplotlib in a wx application embedding_in_wx.py.
While none of these examples specifically address the issue of file
selection dialogs, if you know something about the backend GUI widget
library, it's easy to add File Selection to the examples provided. 
JDH
From: Carlos <ra...@ho...> - 2003年12月09日 23:40:21
Hi=20
 whats a good way to add a file open dialog box to a matplotlib =
script like the one in the demo called "simple_plot.py". I'm new to =
python and am really impressed with using matplotlib. Is there an EZ way =
to add a file select dialog?
_____________________________
From: John H. <jdh...@ac...> - 2003年12月07日 15:17:10
>>>>> "LUK" == LUK ShunTim <shu...@po...> writes:
 LUK> I had matplotlib installed in another location, not under the
 LUK> default python main tree and use the environmental variable
 LUK> AFMPATH to point to the afm fonts files. The backend_wx(.py)
 LUK> relies on distutils.sysconfig.PREFIX to find the GUI bitmap
 LUK> files. Adding the following 2 lines
A number of people have reported problems with matplotlib in
non-default install locations. I'll try and get these cleared up
before the next release.
Thanks! 
John Hunter
From: John H. <jdh...@ac...> - 2003年12月07日 15:16:00
>>>>> "Flavio" == Flavio C Coelho <fcc...@fi...> writes:
 Flavio> some other example fail with the exact same traceback... I
 Flavio> believe the problem lies with the gtk backend, since the
 Flavio> same example runs fine with the WX backend.
Your error message suggests to me that you have an out-of-day CVS
copy, which is not surprising since sourceforge seems to have problem
staying current.
Grab another copy when you get the chance and let me know if you have
any more problems.
JDH
657 messages has been excluded from this view by a project administrator.

Showing results of 36569

<< < 1 .. 1455 1456 1457 1458 1459 .. 1463 > >> (Page 1457 of 1463)
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 によって変換されたページ (->オリジナル) /