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

Showing results of 290

1 2 3 .. 12 > >> (Page 1 of 12)
From: Viraj V. <vir...@gm...> - 2007年06月30日 20:44:07
hello ppl,
hey i hav 3 .dat files... one has 1 column of x coords, another has 1 column
of the same number of y coords and the last .dat file has the same number of
corresponding values of a property[temperature] at those points in 1
column.... i was wondering how i cud make a contour of this data with the
last .dat file being the z-values... i hav written the following code(
saf2.py)[mind u ppl am a newbie @ python+matplotlib]...
from pylab import *
x = load('xcord2.dat')
y = load('ycord2.dat')
X, Y = meshgrid(x, y)
Z = load('output1im.dat')
contour(X,Y,Z)
show()
the following errors crop up:
Traceback (most recent call last):
 File "F:\Python25\saf2.py", line 9, in <module>
 contour(X,Y,Z)
 File "F:\Python25\Lib\site-packages\matplotlib\pylab.py", line 1776, in
contour
 ret = gca().contour(*args, **kwargs)
 File "F:\Python25\Lib\site-packages\matplotlib\axes.py", line 4674, in
contour
 return ContourSet(self, *args, **kwargs)
 File "F:\Python25\Lib\site-packages\matplotlib\contour.py", line 429, in
__init__
 x, y, z = self._contour_args(*args) # also sets self.levels,
 File "F:\Python25\Lib\site-packages\matplotlib\contour.py", line 601, in
_contour_args
 x,y,z = self._check_xyz(args[:3])
 File "F:\Python25\Lib\site-packages\matplotlib\contour.py", line 577, in
_check_xyz
 raise TypeError("Input z must be a 2D array.")
TypeError: Input z must be a 2D array.
wat errors am i making?
From: darkside <in....@gm...> - 2007年06月29日 18:01:04
It's unbeliable. Yes, it works now!!! At least.............. I had spend a
lot of time with these!
So maybe is it a bug? Matplotlib developers: here you have a bug.
Thank you very much for your help, I coud never have thougt that it was the
problem.
2007年6月28日, Matthias Michler <Mat...@gm...>:
>
> Hello darkside,
>
> I tried your example and it works for me (with mpl-svn) using GTKAgg and
> doesn't work (like you reported) using TKAgg (Is this a bug?).
> Maybe you can switch to GTKAgg?
> Otherwise you should report the mpl-version you are using.
> >-------------------------------------
> import matplotlib
> #matplotlib.use("TKAgg")
> matplotlib.use("GTKAgg")
> import pylab
> >---------------------------------------
>
> best regards,
> Matthias
>
> On Thursday 28 June 2007 19:39, darkside wrote:
> > Hello everyone,
> > I'm trying to do a program that opens two different plots and select one
> > point of each one with a mouse event. Here you have my example:
> >
> >
> > --------------------------
> > import pylab
> >
> > def click(event):
> > global x # allow to change global variable
> > if event.button == 1:
> > if event.inaxes:
> > x = event.xdata # change global variable
> > print " x - intern = ", x
> > pylab.disconnect(cid)
> > pylab.close()
> > return x
> >
> > xlist = [] # list for x values
> > global x
> > #for i in xrange(4):
> > fig = pylab.figure()
> > ax = fig.add_subplot(111)
> > pylab.title('primera')
> > cid = pylab.connect('button_press_event', click)
> > pylab.show()
> > print " x - extern = ", x
> > xlist.append(x)
> > pylab.close()
> >
> > fig = pylab.figure()
> >
> > ax = fig.add_subplot(111)
> > pylab.title('segunda')
> > cid = pylab.connect('button_press_event', click)
> > pylab.show()
> > print " x - extern = ", x
> > xlist.append(x)
> > pylab.close()
> > --------------------------------------------------
> > The problem is that the click event only works with the first plot, in
> the
> > second one I get the plot, but not the mouse event. So my output is:
> > x - intern = 0.696277915633
> > x - extern = 0.696277915633
> > x - extern = 0.696277915633
> > As you see, I only get the x-intern once.
> >
> > Does anybody know what I'm doing wrong?
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jd...@gm...> - 2007年06月29日 15:25:53
On 6/29/07, Matt Newville <new...@ca...> wrote:
> I don't think you need to change the wx backend to make a MPL plot
> appear in a dockable pane. You can definitely create a wx.Panel and
> put a MPL Figure in it such as (untested code):
But he wants to use pylab in a shell in his wx environment....
JDH
From: Rein v. d. B. <re...@sc...> - 2007年06月29日 15:23:15
Thanks!
does this also allows the use of the pylab interface? I would like to
use pylab from the command line (in a pycrust shell that i can embed in
a dockable window) and let the figures pop-up in a dockable window too.
But still from the command line use the same commands as i would for
pylab from say ipython.
Regards
Rein
On Fri, 2007年06月29日 at 10:17 -0500, Matt Newville wrote:
> Rein,
> 
> I don't think you need to change the wx backend to make a MPL plot
> appear in a dockable pane. You can definitely create a wx.Panel and
> put a MPL Figure in it such as (untested code):
> 
> <untested code snippet>
> import wx
> import matplotlib
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
> from matplotlib.figure import Figure
> 
> class MyPlotPanel(wx.Panel):
> def __init__(self, parent, **kw):
> wx.Panel.__init__(self, parent, -1, **kw)
> self.fig = Figure(self,(6.0,4.0), dpi=96)
> self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75])
> self.canvas = FigureCanvasWxAgg(self,-1, self.fig)
> 
> </untested code snippet>
> 
> and then use self.axes.plot() (or other methods) and canvas.draw().
> Of course, you'll have to put that Panel someplace. I haven't tried
> to make a plot in a dockable window myself, but I'd be surprised if
> you couldn't do it.
> 
> Take a look at wxmpl http://agni.phys.iit.edu/~kmcivor/wxmpl/
> and/or my own PlotPanel code from MPlot:
> http://cars9.uchicago.edu/~newville/Python/MPlot/
> and/or read http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx
> for more hints and examples.
> 
> Cheers,
> 
> --Matt Newville
From: Matt N. <new...@ca...> - 2007年06月29日 15:17:30
Rein,
I don't think you need to change the wx backend to make a MPL plot
appear in a dockable pane. You can definitely create a wx.Panel and
put a MPL Figure in it such as (untested code):
<untested code snippet>
import wx
import matplotlib
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.figure import Figure
class MyPlotPanel(wx.Panel):
 def __init__(self, parent, **kw):
 wx.Panel.__init__(self, parent, -1, **kw)
 self.fig = Figure(self,(6.0,4.0), dpi=96)
 self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75])
 self.canvas = FigureCanvasWxAgg(self,-1, self.fig)
</untested code snippet>
and then use self.axes.plot() (or other methods) and canvas.draw().
Of course, you'll have to put that Panel someplace. I haven't tried
to make a plot in a dockable window myself, but I'd be surprised if
you couldn't do it.
Take a look at wxmpl http://agni.phys.iit.edu/~kmcivor/wxmpl/
and/or my own PlotPanel code from MPlot:
http://cars9.uchicago.edu/~newville/Python/MPlot/
and/or read http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx
for more hints and examples.
Cheers,
--Matt Newville
From: John H. <jd...@gm...> - 2007年06月29日 14:47:47
On 6/29/07, Rein van den Boomgaard <re...@sc...> wrote:
> OK that is the file that i looked into already. Is the backend
> functionality i need really concentrated in only these files?
> (amazing..)
pretty much - - there is a pretty tight segregation between the figure
and the gui.
> BTW is there a design document to get some grasp on the architecture of
> matplotlib / pylab? It seems that most documentation concentrates on
> describing pylab. Probably most people are using pylab (as i do most of
> the time...).
backend_template.py and backend_bases.py are good starting points.
There is a chapter in the user's guide and some resources at
http://matplotlib.sourceforge.net/faq.html#OO
JDH
>
> Regards
> Rein
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thanos P. <pt...@gm...> - 2007年06月29日 14:40:59
Hello list,
I am plotting some time series data, and the ranges vary dramatically. I
cannot find a way to configure the major and minor ticking (hours and days
respectively) to scale automatically: if the range is too large, put a tick
every 8 hours instead of one, or even place a minor day tick every week and
dont do any hour ticking.
 ax.plot_date(date2num(times),points,'-',color="blue")
 days = DayLocator()
 daysFmt = DateFormatter('%d/%m')
 ax.xaxis.set_minor_locator(days)
 ax.xaxis.set_minor_formatter(daysFmt)
 hours = HourLocator()
 hours.autoscale()
 hoursFmt = DateFormatter('%H')
 ax.xaxis.set_major_locator(hours)
 ax.xaxis.set_major_formatter(hoursFmt)
 for tick in ax.xaxis.get_minor_ticks():
 tick.set_pad(13)
The pad trick is a cool answer I got in a previous post.
From: Rein v. d. B. <re...@sc...> - 2007年06月29日 14:39:41
> On 6/29/07, Rein van den Boomgaard <re...@sc...> wrote:
> > thanks for answering. I have seen the examples using the oo mpl api,
> but
> > i would like to use the pylab interface from the shell i'm using
> (also
> > in the wx GUI). I'm aiming at a very simplified matlab like
> interface
> > where the plots apear in the dockable windows.
> 
> You will probably need to write your own modified backend based on
> backend_wx and backend_wxagg, that replaces the new_figure_manager and
> FigureManager code with some custom functionality to use your panes.
> 
> 
OK that is the file that i looked into already. Is the backend
functionality i need really concentrated in only these files?
(amazing..)
I'll give it a try.
BTW is there a design document to get some grasp on the architecture of
matplotlib / pylab? It seems that most documentation concentrates on
describing pylab. Probably most people are using pylab (as i do most of
the time...).
Regards
Rein
From: Nicolas <nic...@ya...> - 2007年06月29日 13:59:37
Hi,
I can figure the first steps :
something like :
 matrix = []
 buffer = self.get_renderer().tostring_argb()
 l, h = self.GetSize()
 for ligne in xrange(h):
 matrix.append([])
 for colonne in xrange(l):
 i = 4*(ligne*h + colonne)
 pixel = buffer[i:i+4]
 matrix[-1].append(pixel)
 zone_to_export = array(matrix)[pixely0:pixely1, pixelx0:pixelx1]
 new_buffer = buffer("".join("".join(elt for elt in ligne) for
ligne in zone_to_export ))
But then I don't know what to with this new buffer.
I tried to create a new RenderAgg instance, so as to use its png export
facilities.
r = RendererAgg(pixelx1 - pixelx0, pixely1 - pixely0, Value(dpi))
...
r._renderer.write_png(nom)
But I don't know what to put between the two previous lines.
How may I load a buffer content into a RenderAgg instance ?
I suppose I may use something like :
r.draw_image(0, 0, im)
but what is the correct format for im ? Is there an Image class in
matplotlib (I looked for, but didn't find).
How may I convert my buffer ?
Thanks a lot,
Nicolas
How may I transform my buffer into an image ?
On 6/28/07, John Hunter <jd...@gm...> wrote:
>
> On 6/28/07, Nicolas <nic...@ya...> wrote:
> > Thanks for your reply.
> >
> > However, I don't want to had a PIL dependency.
> >
> > Is there any other method, using only matplotlib or wx ?
>
> agg offers methods to convert the image pixel buffer to strings or
> buffers, which you could then convert to numpy arrays, so a slice
> extraction, and reconvert back to a buffer and ultimately a PNG. I
> don't have time right now to write some example code, but you may want
> to poke around in backend_agg to see if you can figure it out, and if
> not remind me next week.
>
> Thanks,
> JDH
>
From: Rein v. d. B. <re...@sc...> - 2007年06月29日 13:06:43
correcting the previous post:
the plot() works from the Shell, so the 'only' problem now is to force
the plot in a pane and not in a frame...
Rein
From: Rein v. d. B. <re...@sc...> - 2007年06月29日 12:55:06
Dear All,
Let me explain what i have in mind:
- wx widgets AUI interface with dockable panes
	+ editor pane (OK)
	+ (pycrust) shell pane (mostly OK)
	+ figure panes
The last one is the important one now. I would like the figure command
in matplotlib/pylab to use a pane in my GUI instead of a frame. 
I've seen the embed-in-wx-example but it seems you then lose the
convenient pylab interface for plotting.
>From the Shell from pycrust i can import pylab and do anything except
showing the plot. The figure window shows up with a show() (after a
plot()) but then it draws nothing.
Can anyone tell me what is going wrong and how i could solve the
problem.
Regards
Rein
From: Edin S. <edi...@gm...> - 2007年06月29日 05:33:04
Hi Alexander,
On 6/28/07, Alexander Dietz <Ale...@as...> wrote:
> Hi,
>
> I have problems installing matplotlib 0.90.1. An error occurs when doing
> "python setup.py build":
>
> /usr/include/features.h:150:1: warning: this is the location of the previous
> definition
> src/_ns_backend_agg.cpp: In member function `Py::Object
> RendererAgg::write_png(const Py::Tuple&)':
> src/_ns_backend_agg.cpp:2040: error: `png_structp' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2040: error: (Each undeclared identifier is reported
> only once for each function it appears in.)
> src/_ns_backend_agg.cpp:2040: error: expected `;' before "png_ptr"
> src/_ns_backend_agg.cpp:2041: error: `png_infop' undeclared (first use this
> function)
> src/_ns_backend_agg.cpp:2041: error: expected `;' before "info_ptr"
> src/_ns_backend_agg.cpp:2042: error: aggregate `png_color_8_struct sig_bit'
> has incomplete type and cannot be defined
> src/_ns_backend_agg.cpp:2043: error: `png_uint_32' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2043: error: expected `;' before "row"
> src/_ns_backend_agg.cpp:2045: error: `png_bytep' undeclared (first use this
> function)
> src/_ns_backend_agg.cpp:2045: error: `row_pointers' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2045: error: `png_bytep' has not been declared
> src/_ns_backend_agg.cpp:2046: error: `row' undeclared (first use this
> function)
> src/_ns_backend_agg.cpp:2057: error: `png_ptr' undeclared (first use this
> function)
> src/_ns_backend_agg.cpp:2057: error: `PNG_LIBPNG_VER_STRING' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2057: error: `png_create_write_struct' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2064: error: `info_ptr' undeclared (first use this
> function)
> src/_ns_backend_agg.cpp:2064: error: `png_create_info_struct' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2067: error: `png_destroy_write_struct' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2079: error: `png_init_io' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2082: error: `PNG_COLOR_TYPE_RGB_ALPHA' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2082: error: `PNG_INTERLACE_NONE' undeclared (first
> use this function)
> src/_ns_backend_agg.cpp:2083: error: `PNG_COMPRESSION_TYPE_BASE' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2083: error: `PNG_FILTER_TYPE_BASE' undeclared
> (first use this function)
> src/_ns_backend_agg.cpp:2083: error: `png_set_IHDR' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2092: error: `png_set_sBIT' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2094: error: `png_write_info' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2095: error: `png_write_image' undeclared (first use
> this function)
> src/_ns_backend_agg.cpp:2096: error: `png_write_end' undeclared (first use
> this function)
> error: command 'gcc' failed with exit status 1
You probably need to install the header files for libpng. On my
Ubuntu system the package name is libpng12-dev
> Any ideas what I can do?
> Also, how to install matplotlib in an other directory? I tried:
> > python setup.py --prefix=/home/Install install
> and
> >python setup.py install --prefix=/home/Install
>
> but both commands did not work, although it is written I shall use the
> '--prefix' argument to specify a different directory !?!
>
> Any ideas?
Is /home/Install on your Python search path (
http://docs.python.org/inst/search-path.html )?
HTH,
Edin
From: Steve S. <sw...@sf...> - 2007年06月28日 19:52:33
I successfully worked around the problem. Since the system OS is 
Centos, which is RedHat Enterprise built from the SRPMS, I grabbed the 
Fedora srpms for matplotlib and the associated dependencies, built and 
installed them. Since they were almost all python related it avoided 
the potential problems with installing Fedora rpms on a RHEL/Centos 
system. After doing this mathtext-related key errors did not occur.
I hope at some point in the future to go back and see what was actually 
different with install built from Fedora, however at this point I am 
still trying to get the system back in production use.
Steve Sweet wrote:
> Hi Edin,
>
> If I try without a matplotlibrc file at all I get the same error. When 
> I first installed I didn't have one other than the one installed by the 
> distribution. I thought that might be the problem so I created one (and 
> verified that it is actually being read) but I still get the errors.
>
> Steve
>
> Edin Salkovic wrote:
> 
>> Hi Steve,
>>
>> On 6/27/07, Steve Sweet <sw...@sf...> wrote:
>> 
>>> Hi,
>>>
>>> I've installed matplotlib-0.90.1 on a Centos 5.0 box (Centos is
>>> identical to RedHat Enterprise). One of my users is running a script
>>> that previously worked with matplotlib on another system. I'm seeing
>>> the following errors
>>> [Wed Jun 27 12:25:17 2007] [error] [client 10.0.0.92] PythonHandler
>>> cv_wms: KeyError: 'mathtext.mathtext2'
>>>
>>> I've done a bit of snooping through the code and I searched the mailing
>>> list archive. I saw a message relating to matplotlib-0.87 indicating
>>> that the missing key needed to be added to the matplotlibrc file.
>>> However when I do so I get this message:
>>> [Wed Jun 27 12:17:35 2007] [error] [client x.x.x.x] Bad key
>>> "mathtext.mathtext2" on line 260 in
>>> [Wed Jun 27 12:17:35 2007] [error] [client x.x.x.x]
>>> /var/www/.matplotlib/matplotlibrc.
>>>
>>> When I remove the offending key I am back to the first error. I am
>>> using the matplotlibrc file that came with the 0.90.1 tarball. Does
>>> anyone have any suggestions?
>>>
>>> Thanks.
>>> 
>> It seems like you have another (older) installation of matplotlib
>> somewhere on that system.
>>
>> Note that newer matplotlibs don't even require a matplotlibrc file in
>> the $HOME/.matplotlib dir. Have you tried removing it completely?
>>
>> If you still have problems, please post some more info.
>>
>> Edin
>> 
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Steve S. <sw...@sf...> - 2007年06月28日 18:15:40
Hi Edin,
If I try without a matplotlibrc file at all I get the same error. When 
I first installed I didn't have one other than the one installed by the 
distribution. I thought that might be the problem so I created one (and 
verified that it is actually being read) but I still get the errors.
Steve
Edin Salkovic wrote:
> Hi Steve,
>
> On 6/27/07, Steve Sweet <sw...@sf...> wrote:
>> Hi,
>>
>> I've installed matplotlib-0.90.1 on a Centos 5.0 box (Centos is
>> identical to RedHat Enterprise). One of my users is running a script
>> that previously worked with matplotlib on another system. I'm seeing
>> the following errors
>> [Wed Jun 27 12:25:17 2007] [error] [client 10.0.0.92] PythonHandler
>> cv_wms: KeyError: 'mathtext.mathtext2'
>>
>> I've done a bit of snooping through the code and I searched the mailing
>> list archive. I saw a message relating to matplotlib-0.87 indicating
>> that the missing key needed to be added to the matplotlibrc file.
>> However when I do so I get this message:
>> [Wed Jun 27 12:17:35 2007] [error] [client x.x.x.x] Bad key
>> "mathtext.mathtext2" on line 260 in
>> [Wed Jun 27 12:17:35 2007] [error] [client x.x.x.x]
>> /var/www/.matplotlib/matplotlibrc.
>>
>> When I remove the offending key I am back to the first error. I am
>> using the matplotlibrc file that came with the 0.90.1 tarball. Does
>> anyone have any suggestions?
>>
>> Thanks.
>
> It seems like you have another (older) installation of matplotlib
> somewhere on that system.
>
> Note that newer matplotlibs don't even require a matplotlibrc file in
> the $HOME/.matplotlib dir. Have you tried removing it completely?
>
> If you still have problems, please post some more info.
>
> Edin
From: Matthias M. <Mat...@gm...> - 2007年06月28日 18:12:04
Hello darkside,
I tried your example and it works for me (with mpl-svn) using GTKAgg and 
doesn't work (like you reported) using TKAgg (Is this a bug?). 
Maybe you can switch to GTKAgg?
Otherwise you should report the mpl-version you are using.
>-------------------------------------
import matplotlib
#matplotlib.use("TKAgg")
matplotlib.use("GTKAgg")
import pylab
>---------------------------------------
best regards,
Matthias
On Thursday 28 June 2007 19:39, darkside wrote:
> Hello everyone,
> I'm trying to do a program that opens two different plots and select one
> point of each one with a mouse event. Here you have my example:
>
>
> --------------------------
> import pylab
>
> def click(event):
> global x # allow to change global variable
> if event.button == 1:
> if event.inaxes:
> x = event.xdata # change global variable
> print " x - intern = ", x
> pylab.disconnect(cid)
> pylab.close()
> return x
>
> xlist = [] # list for x values
> global x
> #for i in xrange(4):
> fig = pylab.figure()
> ax = fig.add_subplot(111)
> pylab.title('primera')
> cid = pylab.connect('button_press_event', click)
> pylab.show()
> print " x - extern = ", x
> xlist.append(x)
> pylab.close()
>
> fig = pylab.figure()
>
> ax = fig.add_subplot(111)
> pylab.title('segunda')
> cid = pylab.connect('button_press_event', click)
> pylab.show()
> print " x - extern = ", x
> xlist.append(x)
> pylab.close()
> --------------------------------------------------
> The problem is that the click event only works with the first plot, in the
> second one I get the plot, but not the mouse event. So my output is:
> x - intern = 0.696277915633
> x - extern = 0.696277915633
> x - extern = 0.696277915633
> As you see, I only get the x-intern once.
>
> Does anybody know what I'm doing wrong?
From: darkside <in....@gm...> - 2007年06月28日 17:39:27
Hello everyone,
I'm trying to do a program that opens two different plots and select one
point of each one with a mouse event. Here you have my example:
--------------------------
import pylab
def click(event):
 global x # allow to change global variable
 if event.button == 1:
 if event.inaxes:
 x = event.xdata # change global variable
 print " x - intern = ", x
 pylab.disconnect(cid)
 pylab.close()
return x
xlist = [] # list for x values
global x
#for i in xrange(4):
fig = pylab.figure()
ax = fig.add_subplot(111)
pylab.title('primera')
cid = pylab.connect('button_press_event', click)
pylab.show()
print " x - extern = ", x
xlist.append(x)
pylab.close()
fig = pylab.figure()
ax = fig.add_subplot(111)
pylab.title('segunda')
cid = pylab.connect('button_press_event', click)
pylab.show()
print " x - extern = ", x
xlist.append(x)
pylab.close()
--------------------------------------------------
The problem is that the click event only works with the first plot, in the
second one I get the plot, but not the mouse event. So my output is:
 x - intern = 0.696277915633
 x - extern = 0.696277915633
 x - extern = 0.696277915633
As you see, I only get the x-intern once.
Does anybody know what I'm doing wrong?
From: darkside <in....@gm...> - 2007年06月28日 17:17:51
Hello,
I don't know what I'm doing wrong, but it don't work for me.
I have to open different sets of data, plot it, select an initial point,
make some calculations and save all the data.
Each plot have a diferente initial point, so I thought of do this with a fo=
r
sentences, opening each plot, doing all and so on.
But I open the first one, and then it plots the second one, but don't let m=
e
select the original point, it catches the previos one. And the same for the
rest.
And I don't know why it doesn't work.
Here you have all the program:
--------------------------
#!/usr/bin/python
# -*- encoding: latin1 -*-
#Importamos los m=F3dulos necesarios:
import Numeric as num
import pylab
import random
import array
import sys
from matplotlib.widgets import SpanSelector
from matplotlib.widgets import Cursor
#Leemos el fichero que contiene el valor de la energia y la suma de los
espines:
def readfiles(filename):
 """
 Lee el fichero donde estan los datos. La primera fila del fichero nos d=
a
la temperatura y el numero de puntos.
 Las dos columnas tienen la energia y la suma de los spines.
 """
 fin =3D open (filename, 'r')
 fields =3D fin.readline()
 fin.close()
 labels =3D fields[1:].split()
 t =3D eval(labels[1])
 n =3D eval(labels[6])
 datos =3D pylab.load(filename,comments=3D'#')
 energia =3Ddatos[:,0]
 sumspines =3Ddatos[:,1]
 return t, n, energia, sumspines
def filelist(filename):
 fin =3D open(filename,'r')
 files =3D []
 for line in fin:
 files.append(line[:-1]),
 return files
def writefile(filename,start,cv,mag,t):
 """
 Escribimos en un fichero todos los datos de punto de corte, calores
especificos,
 magnetizacion y temperatura
 """
 fout =3D open(filename,'w')
 fout.write ("#punto de corte cv magnetizacion temperatura"=
)
 for i in range (len(start)):
 fout.write("%f \t %f \t %f \t %f \n" % (start[i],cv[i],
mag[i], t[i]))
 fout.close()
def cv(energia,T,n,g,start):
 """
 Calculamos el calor espec=EDfico segun la formula:
 Cv=3D k*B**2/(nx*ny)*(<H=B2> - <H>=B2
 donde:
 <H>=B2 =3D (sumatorio H/n) **2
 <H=B2> =3D (sumatorio H) **2 /n
 """
 hp =3D sum(energia[start:])/(n*g*g*2.)
 energia2 =3D num.asarray(energia)
 hp2 =3D sum(energia2[start:]**2)/n*(g*g*2)**2
# print 'Algunos valores de la energia: ',energia[start:start+10]
 return (hp2-hp**2)/(g*g*T**2)
def mag(sumspines,n,g,start):
 """
 Calculamos la magnetizacion, usando la formula:
 <M> =3D (sumatorio S) /n
 """
# print 'Algunos valores de sumspines: ', sumspines[start:start+10]
# print 'la n es: ', n
 return sum(sumspines[start:]) /(n*g*g)
def grid(zn):
 im1 =3D pylab.imshow(zn, cmap=3Dpylab.cm.gray, interpolation=3D'nearest=
')
 pylab.show()
def plotear(energia):
 fig=3Dpylab.figure(figsize=3D(8,6))
 ax =3D fig.add_subplot(111)
 x=3Dpylab.arange(0,len(energia),1)
 ax.plot(x,energia,linewidth=3D2)
 pylab.grid(True)
 cursor =3D Cursor(ax, useblit=3DFalse, color=3D'red', linewidth=3D2)
 cursor.horizOn =3D False
def click(event):
 global x
 #x,y =3D event.x,event.y
 if event.button =3D=3D 1:
 if event.inaxes:
# print 'coordenada x', event.xdata
 x =3D event.xdata
 pylab.disconnect(cid)
 pylab.close()
 return x
def main0 ():
 global cid
 filename =3D raw_input("Introduce el fichero de datos: ")
# t=3D temperatura
# n=3D numero de pasos
# energia =3D valores de la energia, sin normalizar (hay que multiplicar po=
r
# 1/( 2*nx*ny)
# sumspines=3D valor de la suma de los espines para cada energia
# g =3D grid (nx =3Dny)
 t, n, energia, sumspines =3D readfiles(filename)
 g =3D float(filename[(filename.find('-')+1):])
 plotear(energia)
 cid =3D pylab.connect('button_press_event', click)
 pylab.show()
 x1 =3D int(x)
 print 'Coordenada x: ',x1
 print 'El calor especifico es: ',cv(energia,t, n,g,x1)
 print 'La magnetizacion es: ', mag(sumspines,n,g,x1)
def main1():
 global x, cid
 filename =3D raw_input("Introduce el fichero con la lista: ")
 files =3D filelist(filename)
 start=3D[]
 cvall=3D[]
 magall=3D[]
 ts=3D[]
 for i in range(len(files)):
 t,n,energia,sumspines=3D readfiles(files[i])
 g =3D float(files[1][(files[1].find('-')+1):])
 plotear(energia)
 cid =3D pylab.connect('button_press_event', click)
 pylab.show()
 x1 =3D int(x)
 start.append(x1)
 cv1=3Dcv(energia,t, n,g,start[i])
 mag1=3D mag(sumspines,n,g,start[i])
 cvall.append(cv1)
 magall.append(mag1)
 ts.append(t)
 print 'Coordenada x: ',x1
 print 'El calor especifico es: ',cv1
 print 'La magnetizacion es: ', mag1
 filename2=3D'resultados_globales.%s' % (g)
 writefile(filename2,start,cvall,magall,ts)
def main2():
 print "todavia no esta hecho"
if __name__ =3D=3D "__main__":
 print "Selecciona una de las siguientes opciones: \n "
 print "Un solo fichero de datos (0)"
 print "Lista de ficheros de datos (1)"
 print "Lista de ficheros de datos y valores de corte (2)"
 option =3D input()
 if option =3D=3D0:
 main0()
 if option =3D=3D 1:
 main1()
 if option =3D=3D2:
 main2()
 -------------------------------------
2007年6月27日, Matthias Michler < Mat...@gm...>:
>
> Hello darkside,
>
> I'm a little confused that you are sending the email directly to me ...
> and I'm not sure I really understand your problem, but I set up an exampl=
e
> that hopefully satify your needs and shows that it works in principle :
> >------------------------------------------------------------------------=
-----------------------------------
>
> import pylab
>
> def click(event):
> global x # allow to change global variable
> if event.button =3D=3D 1:
> if event.inaxes:
> x =3D event.xdata # change global variable
> print " x - intern =3D ", x
> pylab.disconnect(cid)
> pylab.close()
>
> xlist =3D [] # list for x values
> global x
> for i in xrange(8):
> pylab.figure ()
> pylab.subplot(111)
> pylab.draw()
> cid =3D pylab.connect('button_press_event', click)
> pylab.show()
> print " x - extern =3D ", x
> xlist.append(x)
>
> pylab.figure()
> pylab.subplot(111)
> pylab.plot(xlist, 'b+', ms=3D8, mew=3D4) # plot ensemble of x values
> pylab.show()
>
> >------------------------------------------------------------------------=
-------------------
>
> If this example is not sufficient for you, please set up a little example
> of
> your problem, which can be executed from here, too.
> This you may send to mpl mailing-list.
>
I have already tried this example and it doesn't work for me. It catches
the same x for all the plots.
Thank you for you kind help.
P.D. I send the previous message to you because I clicked the reply button
and I didn't see that it was only you, sorry.
From: John H. <jd...@gm...> - 2007年06月28日 16:22:19
On 6/28/07, Nicolas <nic...@ya...> wrote:
> Thanks for your reply.
>
> However, I don't want to had a PIL dependency.
>
> Is there any other method, using only matplotlib or wx ?
agg offers methods to convert the image pixel buffer to strings or
buffers, which you could then convert to numpy arrays, so a slice
extraction, and reconvert back to a buffer and ultimately a PNG. I
don't have time right now to write some example code, but you may want
to poke around in backend_agg to see if you can figure it out, and if
not remind me next week.
Thanks,
JDH
From: Sven S. <sve...@gm...> - 2007年06月28日 15:37:57
Hi mpl-ers,
while working on some multiple subplots I noticed the following:
1) multiple subplots in a column overlap slightly (xticklabels and the
following title), depending on font size I guess; is this known or how
could this be fixed?
2) the set xticklabels example on p.27 of the current user guide doesn't
seem to work; after looking at the axes.py source I figured out that
	mysubplot.set_xticklabels([])
should work, and it does; on the cookbook page I then found another
solution:
	setp(get_xticklabels(), visible=False)
which I haven't tried. I'm a bit confused by these different approaches
(although I guess it's a feature of mpl); for example wouldn't it be
more natural to just be able to do
	mysubplot.xticklabels = []
which however doesn't work, IIRC.
setup is mpl 0.90.1 with numpy 1.0.3 and python 2.5.1 on windows xp
thanks,
sven
From: Alexander D. <Ale...@as...> - 2007年06月28日 15:25:04
Hi,
I have problems installing matplotlib 0.90.1. An error occurs when doing
"python setup.py build":
/usr/include/features.h:150:1: warning: this is the location of the previous
definition
src/_ns_backend_agg.cpp: In member function `Py::Object
RendererAgg::write_png(const Py::Tuple&)':
src/_ns_backend_agg.cpp:2040: error: `png_structp' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2040: error: (Each undeclared identifier is reported
only once for each function it appears in.)
src/_ns_backend_agg.cpp:2040: error: expected `;' before "png_ptr"
src/_ns_backend_agg.cpp:2041: error: `png_infop' undeclared (first use this
function)
src/_ns_backend_agg.cpp:2041: error: expected `;' before "info_ptr"
src/_ns_backend_agg.cpp:2042: error: aggregate `png_color_8_struct sig_bit'
has incomplete type and cannot be defined
src/_ns_backend_agg.cpp:2043: error: `png_uint_32' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2043: error: expected `;' before "row"
src/_ns_backend_agg.cpp:2045: error: `png_bytep' undeclared (first use this
function)
src/_ns_backend_agg.cpp:2045: error: `row_pointers' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2045: error: `png_bytep' has not been declared
src/_ns_backend_agg.cpp:2046: error: `row' undeclared (first use this
function)
src/_ns_backend_agg.cpp:2057: error: `png_ptr' undeclared (first use this
function)
src/_ns_backend_agg.cpp:2057: error: `PNG_LIBPNG_VER_STRING' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2057: error: `png_create_write_struct' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2064: error: `info_ptr' undeclared (first use this
function)
src/_ns_backend_agg.cpp:2064: error: `png_create_info_struct' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2067: error: `png_destroy_write_struct' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2079: error: `png_init_io' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2082: error: `PNG_COLOR_TYPE_RGB_ALPHA' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2082: error: `PNG_INTERLACE_NONE' undeclared (first
use this function)
src/_ns_backend_agg.cpp:2083: error: `PNG_COMPRESSION_TYPE_BASE' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2083: error: `PNG_FILTER_TYPE_BASE' undeclared
(first use this function)
src/_ns_backend_agg.cpp:2083: error: `png_set_IHDR' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2092: error: `png_set_sBIT' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2094: error: `png_write_info' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2095: error: `png_write_image' undeclared (first use
this function)
src/_ns_backend_agg.cpp:2096: error: `png_write_end' undeclared (first use
this function)
error: command 'gcc' failed with exit status 1
Any ideas what I can do?
Also, how to install matplotlib in an other directory? I tried:
> python setup.py --prefix=/home/Install install
and
>python setup.py install --prefix=/home/Install
but both commands did not work, although it is written I shall use the
'--prefix' argument to specify a different directory !?!
Any ideas?
Thanks
 Alex
From: Nicolas <nic...@ya...> - 2007年06月28日 15:24:24
Thanks for your reply.
However, I don't want to had a PIL dependency.
Is there any other method, using only matplotlib or wx ?
Nicolas
From: Lionel R. <lro...@li...> - 2007年06月28日 15:13:47
Le jeudi 28 juin 2007, Nicolas a =C3=A9crit=C2=A0:
> Hi,
>
> I would like to export a zone of a Figure in .png.
> Something like figure.savefig("mypicture.png", box =3D (0,0,5,5))
> How may I proceed, without drawing all the plots again ?
> I use wxagg.
> Thanks,
>
> Nicolas
>
> ---------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo!
> Mail
Look at PIL, you have normaly a such function there.
=2D-=20
Lionel Roubeyrie - lro...@li...
Charg=C3=A9 d'=C3=A9tudes et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr
From: Nicolas <nic...@ya...> - 2007年06月28日 14:57:00
Hi,
I would like to export a zone of a Figure in .png.
Something like figure.savefig("mypicture.png", box = (0,0,5,5))
How may I proceed, without drawing all the plots again ?
I use wxagg.
Thanks,
Nicolas
 
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
From: <kom...@ya...> - 2007年06月28日 14:23:37
Hello,
I have been trying to plot using custom symbols. I tried three methods:
1) Using LineCollections to plot my own symbols based in a hack kindly
provided by Christopher Barker. Problems: I can not plot the custom
symbols in the legend as the normal markers.
2) Using the custom symbol option in the scatter plot. Problems: the same
as before with the markers in the legend; the symbols looks odd because I
try to plot arrow-like symbols and this feature looks to be thought to
plot closed regular star-like symbols (?).
3) Pathching the source code to define new markers and plot it. This
method works fine but I am tired of patching in a different way each new
release. I realize this is not an "universal" way.
Is there any standar way of plotting custom symbols (with similar
properties as the markers in "plot")?
Thank you.
Regards,
Jose Sabater
From: fred <fr...@gm...> - 2007年06月28日 10:04:03
Alexander Dietz a écrit :
> Hi,
>
Hi,
> I hope this is the right place to post this question, which is related 
> to numpy, or numeric or something else...
I guess you should try scipy-user at scipy.org ml.
Cheers,
-- 
http://scipy.org/FredericPetit
6 messages has been excluded from this view by a project administrator.

Showing results of 290

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