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
|
From: Srinath A. <sr...@fa...> - 2004-04-18 02:37:56
|
Hello, I seem to have uncovered a bug in setting/updating the axis limits. If you run the following example, you should see a straight line between (0,0) and (1,1). Pressing the "Test Zoom" button should reset the axis limits to the values depicted below. Basically, the X axis is clipped between [0.1,0.8] and the Y axis limits are either [0.516,0.517] or [0.5166,0.5167] depending on which of the two lines in the code below is commented. The following bug(s) are seen: 1. In the first case, where the y axis limit is updated to [0.516,0.517], the line should be seen as a sharply vertical line passing starting from x=0.516 and continuing sharply upwards till x=0.517. However, the line seems to start significantly _after_ x=0.52. 2. In the second case, if the ylim variable is changed to [0.5166,0.5167], then the line completely dissapears from the axes view. It seems to fall off the right edge (is my guess), whereas it should be seen as a more or less vertical line passing through x=0.5166. The test code is appended below the signature. Thanks, Srinath import matplotlib matplotlib.use('GTK') from matplotlib.backends.backend_gtk import FigureCanvasGTK from matplotlib.axes import Subplot from matplotlib.figure import Figure import gtk class MyApp: def __init__(self): self.win = gtk.Window() self.win.set_name("Embedding in GTK") self.win.connect("destroy", gtk.mainquit) self.win.set_border_width(5) self.vbox = gtk.VBox(spacing=3) self.win.add(self.vbox) self.vbox.show() self.fig = Figure(figsize=(5,4), dpi=100) self.ax = Subplot(self.fig, 111) self.ax.plot([0,1], [0,1]) self.fig.add_axis(self.ax) self.canvas = FigureCanvasGTK(self.fig) # a gtk.DrawingArea self.canvas.show() self.vbox.pack_start(self.canvas) buttonTestZoom = gtk.Button('Test Zoom') buttonTestZoom.connect('button_press_event', self.TestZoom) buttonTestZoom.show() self.vbox.pack_start(buttonTestZoom) self.win.show() def TestZoom(self, widget, event): self.ax.update_viewlim() xlim = [0.1, 0.8] # this makes the line dissapear from the axes. #ylim = [0.5166, 0.5167] # this shows the line but in the wrong location! ylim = [0.516, 0.517] self.ax.set_xlim(xlim) self.ax.set_ylim(ylim) self.canvas.draw() if __name__=='__main__': app = MyApp() gtk.mainloop() |
From: Srinath A. <sr...@fa...> - 2004-04-17 08:22:22
|
On Fri, 16 Apr 2004, John Hunter wrote: > Yes, this would be a very nive feature. When you implement it, please > send it back to the list. Here is an example that shows you how to > connect to the events and more importantly for you, convert to user > coords > Here's a very preliminary implementation. Its not really very elegant, but it seems to work. A couple of questions. Is there a remove_line or equivalent for axes? As of now, I make the rectangle which shows the zoom window dissapear by setting its xdata and ydata to [], but it might be elegant to just remove the line from the axis completely. Also I seem to trigger a matplotlib bug if I toggle the zoom button and then start the button press event outside the axes. I have yet to delve into the matplotlib source itself and maybe I am not the best person to do it. The best place to add this would be to extend the axes class with a .zoom() method which would work like the ZoomButtonPressed() function below (It basically makes the next button press trigger the ZoomStart() function which in turn calls ZoomContinue() on the "motion_notify_event"). ZoomStart() will have to be modified to account for more than one axes belonging to a figure. We'll have to check whether the user presses the mouse in the axes whos .zoom() function has been called. Thanks again for all the help :) I think I am almost ready to get things working with matplotlib. -- Srinath from matplotlib.numerix import arange, sin, cos, pi import matplotlib matplotlib.use('GTK') from matplotlib.backends.backend_gtk import FigureCanvasGTK from matplotlib.axes import Subplot from matplotlib.figure import Figure import gtk class MyApp: def __init__(self): self.win = gtk.Window() self.win.set_name("Embedding in GTK") self.win.connect("destroy", gtk.mainquit) self.win.set_border_width(5) self.vbox = gtk.VBox(spacing=3) self.win.add(self.vbox) self.vbox.show() self.fig = Figure(figsize=(5,4), dpi=100) self.ax = Subplot(self.fig, 111) self.ax.plot([0,1], [0,1]) self.fig.add_axis(self.ax) self.canvas = FigureCanvasGTK(self.fig) # a gtk.DrawingArea self.canvas.show() self.canvas.connect('motion_notify_event', self.setAxisCursorLocation) self.vbox.pack_start(self.canvas) buttonZoom = gtk.ToggleButton('Toggle Zoom') buttonZoom.connect('button_press_event', self.ZoomButtonPressed) buttonZoom.show() self.vbox.pack_start(buttonZoom) self.win.show() def setAxisCursorLocation(self, widget, event): height = self.canvas.figure.bbox.y.interval() x, y = event.x, height-event.y t = self.ax.xaxis.transData.inverse_positions(x) val = self.ax.yaxis.transData.inverse_positions(y) self.cursorLocation = (t, val) def getAxisCursorLocation(self): if not hasattr(self, 'cursorLocation'): return None return self.cursorLocation def ZoomButtonPressed(self, widget, event): if not widget.get_active(): self.zoomStartEventHandle = self.canvas.connect('button_press_event', self.ZoomStart) else: if hasattr(self, 'zoomStartEventHandle'): self.canvas.disconnect(self.zoomStartEventHandle) def ZoomStart(self, widget, event): self.zoomStartPosition = self.getAxisCursorLocation() x, y = self.zoomStartPosition if hasattr(self, 'zoomRectangle'): self.zoomRectangle.set_xdata([x,x,x,x,x]) self.zoomRectangle.set_ydata([y,y,y,y,y]) else: self.zoomRectangle = self.ax.plot([x,x,x,x,x], [y,y,y,y,y], 'k:')[0] self.zoomContinueEventHandle = self.canvas.connect_after('motion_notify_event', self.ZoomContinue) self.zoomStopEventHandle = self.canvas.connect('button_release_event', self.ZoomStop) def ZoomContinue(self, widget, event): xs, ys = self.zoomStartPosition x, y = self.getAxisCursorLocation() self.zoomRectangle.set_xdata([xs, x, x, xs, xs]) self.zoomRectangle.set_ydata([ys, ys, y, y, ys]) self.canvas.draw() def ZoomStop(self, widget, event): self.canvas.disconnect(self.zoomContinueEventHandle) self.canvas.disconnect(self.zoomStopEventHandle) self.zoomRectangle.set_xdata([]) self.zoomRectangle.set_ydata([]) xs, ys = self.zoomStartPosition x, y = self.getAxisCursorLocation() self.ax.set_xlim([min([xs,x]), max([xs,x])]) self.ax.set_ylim([min([ys,y]), max([ys,y])]) self.canvas.draw() if __name__=='__main__': app = MyApp() gtk.mainloop() |
From: John H. <jdh...@ac...> - 2004-04-16 22:42:45
|
>>>>> "Jim" == Jim Benson <jb...@se...> writes: Jim> Hi, Jim> I seem to be seeing some extra debug output. I have been Jim> using the wx background and the embedding_in_wx.py example as Jim> a template for how to make matplotlib plots in an app i'm Jim> writing. This part works great!! I am however seeing what Jim> appears to be a debug flag left on somewhere? No, this is in the wx code. I traced it to the line wxInitAllImageHandlers() Miraculously, I commented this out, got rid of the annoying messages, and fixed the wx exception swallowing bug! Jeremy and I have been killing ourselves for about 6 months trying to figure out why backend wx was swallowing our exceptions, and I can't really convey how happy I am to have found this. We have tried all manner of hacks, google searches and plantive pleas to get our exceptions back to no avail. It made debugging wx virtually impossible. Please test this change on your system. win32 users, I would also be much obliged if you could try commenting this out on your system to see if you lose functionality. On my linux box, the figures came up as expected, I was able to print to jpg and png, so all looks well. Note, wxagg is in CVS if you need some of the agg features that native wx drawing does not provide. But it looks like all systems are go for a release next week so you may as well wait. JDH |
From: John H. <jdh...@ac...> - 2004-04-16 22:21:49
|
>>>>> "Srinath" == Srinath Avadhanula <sr...@fa...> writes: Srinath> Hello all! I just recently downloaded Matplotlib and Srinath> love it so far :) Thanks! Srinath> A hopefully quick question. In all the demo examples, the Srinath> navigation bar has buttons for incremental +/- zoom in Srinath> the X/Y directions, but no way to directly choose a Srinath> rectange within the figure window to zoom to like in Srinath> matlab. It gets very tedious the way it is if a lot of Srinath> zooming and panning is involved. Srinath> I found that I could draw a rectange in the axes and Srinath> update its coordinates on an motion_notify_event. The Srinath> problem is I do not know how to link the Srinath> event.get_pointer() coordinates to the coordinates within Srinath> the axes. Therefore I cannot set the coordinates of the Srinath> rectangle correctly. The following code which is slightly Srinath> modified from embed_gtk2.py demonstrates what I am trying Srinath> to do... Yes, this would be a very nive feature. When you implement it, please send it back to the list. Here is an example that shows you how to connect to the events and more importantly for you, convert to user coords """ An example of how to interact with the plotting canvas by connecting to move and click events """ from matplotlib.matlab import * t = arange(0.0, 1.0, 0.01) s = sin(2*pi*t) ax = subplot(111) ax.plot(t,s) canvas = get_current_fig_manager().canvas def on_move(widget, event): # get the x and y coords, flip y from top to bottom height = canvas.figure.bbox.y.interval() x, y = event.x, height-event.y if ax.in_axes(x, y): # transData transforms data coords to display coords. Use the # inverse method to transform back t = ax.xaxis.transData.inverse_positions(x) val = ax.yaxis.transData.inverse_positions(y) print t, val def on_click(widget, event): # get the x and y coords, flip y from top to bottom height = canvas.figure.bbox.y.interval() x, y = event.x, height-event.y if event.button==1: if ax.in_axes(x, y): # transData transforms data coords to display coords. Use the # inverse method to transform back t = ax.xaxis.transData.inverse_positions(x) val = ax.yaxis.transData.inverse_positions(y) print t, val #canvas.connect('motion_notify_event', on_move) canvas.connect('button_press_event', on_click) show() |
From: Srinath A. <sr...@fa...> - 2004-04-16 22:16:49
|
Hello all! I just recently downloaded Matplotlib and love it so far :) A hopefully quick question. In all the demo examples, the navigation bar has buttons for incremental +/- zoom in the X/Y directions, but no way to directly choose a rectange within the figure window to zoom to like in matlab. It gets very tedious the way it is if a lot of zooming and panning is involved. I found that I could draw a rectange in the axes and update its coordinates on an motion_notify_event. The problem is I do not know how to link the event.get_pointer() coordinates to the coordinates within the axes. Therefore I cannot set the coordinates of the rectangle correctly. The following code which is slightly modified from embed_gtk2.py demonstrates what I am trying to do... Thanks, -- Srinath from matplotlib.numerix import arange, sin, cos, pi import matplotlib matplotlib.use('GTK') from matplotlib.backends.backend_gtk import FigureCanvasGTK from matplotlib.axes import Subplot from matplotlib.figure import Figure import gtk class MyApp: def __init__(self): self.win = gtk.Window() self.win.set_name("Embedding in GTK") self.win.connect("destroy", gtk.mainquit) self.win.set_border_width(5) self.vbox = gtk.VBox(spacing=3) self.win.add(self.vbox) self.vbox.show() self.fig = Figure(figsize=(5,4), dpi=100) self.ax = Subplot(self.fig, 111) self.recth = 0.2 self.ylast = 0 x = [0,0.5,0.5,0,0] y = [0,0,self.recth,self.recth,0] t = [0,1] r = [0,1] self.h = self.ax.plot(x,y,t,r) self.fig.add_axis(self.ax) self.canvas = FigureCanvasGTK(self.fig) # a gtk.DrawingArea self.canvas.show() self.canvas.connect('motion_notify_event', self.findClick) self.vbox.pack_start(self.canvas) self.win.show() def findClick(self, widget, event): ynow = event.get_coords()[1] if ynow < self.ylast: self.recth += 0.01 elif ynow > self.ylast: self.recth -= 0.01 self.h[0].set_ydata([0,0,self.recth,self.recth,0]) self.ylast = ynow self.canvas.draw() if __name__=='__main__': app = MyApp() gtk.mainloop() |
From: Jim B. <jb...@se...> - 2004-04-16 17:13:48
|
Hi, I seem to be seeing some extra debug output. I have been using the wx background and the embedding_in_wx.py example as a template for how to make matplotlib plots in an app i'm writing. This part works great!! I am however seeing what appears to be a debug flag left on somewhere? Here is my test script: (test.py) import matplotlib matplotlib.use('WX') from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\ FigureManager #from matplotlib.figure import Figure #from matplotlib.axes import Subplot #import matplotlib.numerix as numpy #from wxPython.wx import * if __name__ == '__main__': print 'Hi There' This works: >>> import test >>> This gives me: clavius:/home/jbenson/python>python test.py [Debug] 10:07:56 AM: Adding duplicate image handler for 'PNG file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'JPEG file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'TIFF file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'GIF file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'PNM file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'PCX file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'XPM file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'Windows icon file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'Windows cursor file' [Debug] 10:07:56 AM: Adding duplicate image handler for 'Windows animated cursor file' Hi There clavius:/home/jbenson/python> I'm using matplotlib-0.52 Is this comming from matplotlib? Is there a flag i should turn off? Thanks, Jim |
From: John H. <jdh...@ac...> - 2004-04-16 16:51:17
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes: Flavio> Jeremy, how can I set axes limits on a figure embedded in Flavio> WX? I am plotting with Flavio> a = self.figmgr.add_subplot(111) a.plot(x,y) Flavio> just like in your example. Flavio> I would like to do someting like: Flavio> axis([0,10,0,10]) There is no axis command in the OO interface (though is would be easy to add..). You can always go to matlab.py and see how it is interacting with the gca instance. If you use your 'a' instance everywhere it uses gca(), you can duplicate it's functionality. Flavio> set(gca(),'xticklabels',[]) set(gca(),'yticklabels',[]) Flavio> set(gca(),'xticks',[]) set(gca(),'yticks',[]) the syntax of set is set(object or sequence, somestring, attribute) if called with an object, set calls object.set_somestring(attribute) if called with a sequence, set does for object in sequence: object.set_somestring(attribute) So for your example, gca() is an object, so a.set_xticklabels([]) a.set_yticklabels([]) a.set_xticks([]) a.set_yticks([]) You may want to take another look at the tutorial section "Controlling axes properties" which gives examples of both the matlab and OO methods To replicate axis, do a.set_xlim((xmin, xmax)) a.set_ylim((ymin, ymax)) Should help! JDH |
From: Philippe S. <phi...@pr...> - 2004-04-16 06:39:06
|
waouw thanks, that's an amazing support! ----- Original Message ----- From: "John Hunter" <jdh...@ac...> To: "Philippe Strauss" <phi...@pr...> Cc: <Mat...@li...> Sent: Friday, April 16, 2004 3:49 AM Subject: Re: [Matplotlib-users] setting grid density > >>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: > > Philippe> This one is 1h per minor grid and tick, 6h per majors. > > Hi Phillipe, > > I just wanted to let you know that I've finished adding the major and > minor tick support for the next release of matplotlib. There is > additional support for plotting dates and formatting dates with major > and minor ticks. There are specialized tick locators for marking > ticks by minute, hour, day, weekday, month, year, every 4 hours, every > 3 months, and so on. There is a new command plot_date function and a > series of date converters to let you plot dates with, for example, > epochs, python datetimes or mx.Datetimes. You can work with custom > date instances by supplying a custom converter. You can format the > date ticks with strftime strings of your choice. > > The major and minor tick support is generic and fully customizable and > should be useful for many other applications. > > Look for the release next week. > > JDH |
From: John H. <jdh...@ac...> - 2004-04-16 02:12:03
|
>>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: Philippe> This one is 1h per minor grid and tick, 6h per majors. Hi Phillipe, I just wanted to let you know that I've finished adding the major and minor tick support for the next release of matplotlib. There is additional support for plotting dates and formatting dates with major and minor ticks. There are specialized tick locators for marking ticks by minute, hour, day, weekday, month, year, every 4 hours, every 3 months, and so on. There is a new command plot_date function and a series of date converters to let you plot dates with, for example, epochs, python datetimes or mx.Datetimes. You can work with custom date instances by supplying a custom converter. You can format the date ticks with strftime strings of your choice. The major and minor tick support is generic and fully customizable and should be useful for many other applications. Look for the release next week. JDH |
From: Peter G. <pgr...@ge...> - 2004-04-15 21:54:58
|
> > VTK, including the Python API, does Delaunay triangulation, and I've > used it to do what you're talking about. IIRC, there are other > Delaunay triangulation codes with Python bindings around. However, > the Matlab function is a little more complicated; they use > interpolation in addition to a straight Delaunay triangulation, and > it often produces nice-looking results. They cite a reference in > either the help file or the .m file; one can presumably read the > reference and re-implement it for use in Python. > > FYI, here's some relevant Python VTK code: > > profile = vtkPolyData() > profile.SetPoints(points) > > delny = vtk.vtkDelaunay2D() > delny.SetInput(profile) > delny.SetTolerance(0.01) > delny.BoundingTriangulationOff() > > normals = vtk.vtkPolyDataNormals() > normals.SetInput(delny.GetOutput()) > > lo,hi = zrange > elevation = vtk.vtkElevationFilter() > elevation.SetInput(delny.GetOutput()) > elevation.SetLowPoint(0, 0, lo) > elevation.SetHighPoint(0, 0, hi) > elevation.SetScalarRange(lo, hi) > elevation.ReleaseDataFlagOn() > > delMesh = vtk.vtkPolyDataMapper() > delMesh.SetInput(elevation.GetOutput()) > delMesh.SetLookupTable(lutLand) # doesn't work > delActor = vtk.vtkActor() > delActor.SetMapper(delMesh) > ren1.AddActor( delActor ) Thanks Andrew. I have tried octave with the octive-forge extensions. In fact I have tried two different versions with three different versions of octave-forge. All seem to be broken in one way or another. I get random segmentation faults here and there on data that other times gets processed properly. Their implementation of griddata gives me some areas (triangles) which are empty even though MATLAB produces nice plots - perhaps some convergence issue. In any case I tried using octave's griddata and plot the result using matplotlib's pcolor. If not for the empty triangles (due to griddata) the plots are precisely what I need. I will look into VTK and see what it can do. Peter |
From: Andrew S. <str...@as...> - 2004-04-14 20:44:32
|
On Apr 14, 2004, at 11:37 AM, Peter Groszkowski wrote: > Hello Everyone: > > Before I reinvent the wheel, I'd thought I'd ask: > > I have a set of x,y points in a plane, and to each a corresponding z. > They are spread out in circular concentric orbits. > I need to do a flat surface plot (via pcolor) of these z values. A > simple algorithm would be: > > #get data for x, y, z.. this would be some fixed points x,y inside > #a box -4<=x<=4 and -4<=y<=4 with a z value for each. > > #Create a grid > xi=linspace(-4,4,200) > yi=linspace(-4,4,200) > [Xi,Yi]=meshgrid(xi,yi) > > # This is the key step; find a z value for each grid point. > Zi=griddata(x,y,z,Xi,Yi) > > pcolor(Xi, Yi, Zi, shading='flat') > > show() > > The key here is this griddata function. It interpolates the surface at > the grid points based on the few data points I provide it with > (x,y,z). It uses Delaunay triangulation, and is part of the standard > MATLAB distribution (more about it here: > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/ > griddata.html#1007265). My question is whether anyone has come across > its implementation in python. I could not find any information in any > of the "standard" math packages. How do people do this? VTK, including the Python API, does Delaunay triangulation, and I've used it to do what you're talking about. IIRC, there are other Delaunay triangulation codes with Python bindings around. However, the Matlab function is a little more complicated; they use interpolation in addition to a straight Delaunay triangulation, and it often produces nice-looking results. They cite a reference in either the help file or the .m file; one can presumably read the reference and re-implement it for use in Python. FYI, here's some relevant Python VTK code: profile = vtkPolyData() profile.SetPoints(points) delny = vtk.vtkDelaunay2D() delny.SetInput(profile) delny.SetTolerance(0.01) delny.BoundingTriangulationOff() normals = vtk.vtkPolyDataNormals() normals.SetInput(delny.GetOutput()) lo,hi = zrange elevation = vtk.vtkElevationFilter() elevation.SetInput(delny.GetOutput()) elevation.SetLowPoint(0, 0, lo) elevation.SetHighPoint(0, 0, hi) elevation.SetScalarRange(lo, hi) elevation.ReleaseDataFlagOn() delMesh = vtk.vtkPolyDataMapper() delMesh.SetInput(elevation.GetOutput()) delMesh.SetLookupTable(lutLand) # doesn't work delActor = vtk.vtkActor() delActor.SetMapper(delMesh) ren1.AddActor( delActor ) Cheers! Andrew |
From: Perry G. <pe...@st...> - 2004-04-14 19:10:19
|
Eugeni Doljenko writes: > > John Hunter wrote: > > > Best is to use the binary string operations tostring and fromstring > > > > > > from Numeric import fromstring, Float > > > # write > > > file('fname.out', 'wb').write(x.tostring()) > > > > > > # read > > > x = fromstring(file('fname.out', 'rb').read(), Float) > > > > > > #If data is MxN you'll need to reshape > > > x.shape = M,N > > > > > > Hope this help, > > > JDH > > > > > > > Note that numarray has a tofile method and a fromfile function > > to do this without going through the copying required by tostring > > and fromstring. Like those, it also doesn't save any shape or > Moreover tostring() and fromstring() are deprecated iirc, because you can > convert arrays from and to strings by StringIO. > I just noticed this recently. It isn't the case that tostring and fromstring are deprecated for numarray. I just wanted to clarify. Perry |
From: Peter G. <pgr...@ge...> - 2004-04-14 18:45:35
|
Hello Everyone: Before I reinvent the wheel, I'd thought I'd ask: I have a set of x,y points in a plane, and to each a corresponding z. They are spread out in circular concentric orbits. I need to do a flat surface plot (via pcolor) of these z values. A simple algorithm would be: #get data for x, y, z.. this would be some fixed points x,y inside #a box -4<=x<=4 and -4<=y<=4 with a z value for each. #Create a grid xi=linspace(-4,4,200) yi=linspace(-4,4,200) [Xi,Yi]=meshgrid(xi,yi) # This is the key step; find a z value for each grid point. Zi=griddata(x,y,z,Xi,Yi) pcolor(Xi, Yi, Zi, shading='flat') show() The key here is this griddata function. It interpolates the surface at the grid points based on the few data points I provide it with (x,y,z). It uses Delaunay triangulation, and is part of the standard MATLAB distribution (more about it here: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/griddata.html#1007265). My question is whether anyone has come across its implementation in python. I could not find any information in any of the "standard" math packages. How do people do this? Thanks, Peter |
From: John H. <jdh...@ac...> - 2004-04-13 18:42:05
|
>>>>> "David" == David Brown <db...@ya...> writes: David> Also, not sure if it's relevant but if I try to continue in David> IDLE I sometimes get "too many files open" errors as well David> as mostly non-working windows. Any suggestions? I have seen problems on win32 with repeatedly loading the same freetype2 font in backend agg. I've implemented several changes in the next release to fix this. Hopefully they will solve your problem. Stay tuned... JDH |
From: David B. <db...@ya...> - 2004-04-13 17:42:59
|
I'm using Tkinter as the backend display for matplotlib and also using IDLE -n. It works fine the first several times I run it but ends up crashing and taking down IDLE and pythonw.exe with it after ~10 runs of the script. I know this is not the best way to use matplotlib right now. Anyway, here's the plotting part of the script (.matplotlib set to interactive mode) if useMatplotlib: yrange = 1.5 wfList = [p1, p2, p3] close() # close last plot window if still open nplots = len(waveformList) i = 0 for p in wfList: i +=1 subplot(nplots,1,i) plot(p, color='#7070a0') axis([0, totalPoints, -yrange, yrange]) ylabel('Volts') grid(True) Here's the eventual error message: Traceback (most recent call last): Exception in Tkinter callback Traceback (most recent call last): File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, in __call__ File "C:\Python23\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 120, in resize File "C:\Python23\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 127, in show File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 342, in draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\figure.py", line 83, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axes.py", line 527, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axis.py", line 395, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axis.py", line 93, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\text.py", line 87, in _draw File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 199, in draw_text File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 227, in compute_text_offsets File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 257, in _get_agg_font RuntimeError: Could not load the facefile File "C:\Documents and Settings\dlbrown\My Documents\Python Scripts\gen_nonlinear_error.py", line 114, in ? File "C:\Python23\lib\site-packages\matplotlib\matlab.py", line 942, in plot File "C:\Python23\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 46, in draw_if_interactive File "C:\Python23\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 127, in show File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 342, in draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\figure.py", line 83, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axes.py", line 527, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axis.py", line 395, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\axis.py", line 93, in _draw File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 88, in draw File "C:\Python23\lib\site-packages\matplotlib\text.py", line 87, in _draw File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 199, in draw_text File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 227, in compute_text_offsets File "C:\Python23\lib\site-packages\matplotlib\backends\backend_agg.py", line 257, in _get_agg_font RuntimeError: Could not load the facefile Also, not sure if it's relevant but if I try to continue in IDLE I sometimes get "too many files open" errors as well as mostly non-working windows. Any suggestions? -- David __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ |
From: Al S. <a.d...@wo...> - 2004-04-13 16:27:24
|
On Tue, 2004-04-13 at 10:12, John Hunter wrote: > >>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: > > Philippe> Hello, I'm new to matplotlib and this list. > Philippe> Congratulation to the developers of this great package, > Philippe> I've been looking for a long while for a good quality > Philippe> plotting package. > > Philippe> I would like to plot time in hours on the x axis, with > Philippe> one minor grid per 15 minutes and one major grid per > Philippe> hour, but I can only see 10 fixed grids on all tutorial > Philippe> and documentation. > > Philippe> How can I configure that? > > No support for minor and major ticks yet, but I can add it pretty > quickly, probably for the next release due out soon. I just need a > little information. How do grids interact with major and minor ticks? > I know major ticks are generally bigger and are labeled, and minor > ticks are smaller and not labeled, but I don't know how grid lines are > usually handled with respect to major and minor ticks. If you have a > link to a canonical figure which uses major and minor ticks, I can > follow that example. > > JDH > I've also been playing around with plots versus time (in my case calendar time) and experimenting with tick style and ticklabel placement computed as a function of the time span. I attached a plot of one of my experiments. (This is where the need for multi-line ticklabels comes from.) The ticks and ticklabels that one wants differ according to the span of time plotted. For instance, for multi-year plots, the ticks are no finer than quarterly, but adjust to monthly, weekly, or daily if the span is sub-year. The tick placement is, of course, not uniform, because of the irregularities in the calendar. I have not experimented with sub-day time-spans of the kind shown by Philippe. -Al Schapira |
From: Philippe S. <phi...@pr...> - 2004-04-13 15:52:30
|
From: "John Hunter" <jdh...@ac... > >>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: > > Philippe> Hello, I'm new to matplotlib and this list. > Philippe> Congratulation to the developers of this great package, > Philippe> I've been looking for a long while for a good quality > Philippe> plotting package. > > Philippe> I would like to plot time in hours on the x axis, with > Philippe> one minor grid per 15 minutes and one major grid per > Philippe> hour, but I can only see 10 fixed grids on all tutorial > Philippe> and documentation. > > Philippe> How can I configure that? > > No support for minor and major ticks yet, but I can add it pretty > quickly, probably for the next release due out soon. I just need a > little information. How do grids interact with major and minor ticks? > I know major ticks are generally bigger and are labeled, and minor > ticks are smaller and not labeled, but I don't know how grid lines are > usually handled with respect to major and minor ticks. If you have a > link to a canonical figure which uses major and minor ticks, I can > follow that example. > > JDH for my application, I need something that looks like Tobias Oetiker RRD tool graph: This one is 1h per minor grid and tick, 6h per majors. Thanks!! |
From: John H. <jdh...@ac...> - 2004-04-13 14:34:48
|
>>>>> "Philippe" == Philippe Strauss <phi...@pr...> writes: Philippe> Hello, I'm new to matplotlib and this list. Philippe> Congratulation to the developers of this great package, Philippe> I've been looking for a long while for a good quality Philippe> plotting package. Philippe> I would like to plot time in hours on the x axis, with Philippe> one minor grid per 15 minutes and one major grid per Philippe> hour, but I can only see 10 fixed grids on all tutorial Philippe> and documentation. Philippe> How can I configure that? No support for minor and major ticks yet, but I can add it pretty quickly, probably for the next release due out soon. I just need a little information. How do grids interact with major and minor ticks? I know major ticks are generally bigger and are labeled, and minor ticks are smaller and not labeled, but I don't know how grid lines are usually handled with respect to major and minor ticks. If you have a link to a canonical figure which uses major and minor ticks, I can follow that example. JDH |
From: Philippe S. <phi...@pr...> - 2004-04-13 13:07:14
|
Hello, I'm new to matplotlib and this list. Congratulation to the developers of this great package, I've been looking for a long while for a good quality plotting package. I would like to plot time in hours on the x axis, with one minor grid per 15 minutes and one major grid per hour, but I can only see 10 fixed grids on all tutorial and documentation. How can I configure that? -- Philippe Strauss |
From: Peter G. <pgr...@ge...> - 2004-04-12 20:50:25
|
John Hunter wrote: [snip] >Here is a sample implementation > >from matplotlib.matlab import * >def segplot(x, y, fmt, maxdelta, **kwargs): > """ > Plot x versus y, breaking the plot at any point where x[i] - > x[i-1] > maxdelta. kwargs are passed on to plot > """ > x = asarray(x) > y = asarray(y) > d = diff(x) > lines = [] > ind = nonzero(greater(d, maxdelta)) > ind = ind+1 > if not len(ind): > lines.extend( plot(x,y,fmt,**kwargs) ) > else: > allind = [0] > allind.extend(ind) > allind.append(len(x)) > for i1,i2 in zip(allind[:-1], allind[1:]): > lines.extend( plot(x[i1:i2], y[i1:i2], fmt, **kwargs) ) > return lines > >t = [0,1,2,3,4,5,105,106,107,187, 200, 212, 300, 320] >s = [1,4,5,3,9,11,-5,-8,3,12, 15, 12, -1, 3] >segplot(t, s, 'b-o', 40, antialiased=False) >grid(True) >show() > >I'm inclined not to make this part of plot, since plot processes a >variable number of arguments it makes it a little difficult. >Certainly doable, but I'm hesitant to put too much on plot because it >might become unwieldy. But a new function, like segment plot, would >be easy enough to include. > >Any suggestions for a name, or additional functionality? > > Thanks for the quick solution. I think the name is just fine. Best, -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA |
From: John H. <jdh...@ac...> - 2004-04-12 17:44:51
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes: Flavio> Sorry, I meant portable in terms of other hardware Flavio> platforms that run Linux but not X, embedded systems for Flavio> instance. The situation I had in mind was to run Flavio> matplotlib in a linux PDA (which are becoming more and Flavio> more popular). The Sharp Zaurus, for instance, runs a kind Flavio> of Qt, for which there is no matplotlib backend. All linux Flavio> systems, big and small, have console interfaces. Although Flavio> I think it may be possible to install GTK or Wx on a PDA Flavio> like the Zaurus, It would not be the the best way to go Flavio> due to limitations of memory and other resources. A Flavio> console Backend wold not only be lighter and faster, but Flavio> could go wherever python can go, independently of heavy Flavio> GUI systems. Flavio> Another solution would be a backend for Qt embedded Flavio> library, but it does need framebuffer as far as I know... Flavio> And it's not only PDAs, matplotlib could run on Flavio> cellphones, set-top boxes, industrial controlers, etc. Flavio> Again it's just a thought, I am a big fan of Links... ;) I'm not familiar with Links.... As far as embedded devices, one possibility is the paint / libart backend. libart was designed to be small and had the embedded market in mind, if I recall correctly. A quick google search appears to indicate that libart is ported to Zaurus. Also, if the embedded device has a recent cxx compiler, it should be able to compile agg. The reason I mention this is that it is fairly straightforward to mix and match an image backend (gd, libart/paint, agg) with a gui toolkit. Witness GTKAgg, TkAgg, WxAgg (forthcoming) and GTKGD. So it might be easier (and more general purpose) to implement QtPaint or QtAgg than it would be to implement a libsvga backend. One thing I've encountered with the variety of image backends (ps, paint, agg and gd) is that it is very difficult to support all the features you want on all the backends. ps - no alpha channel or antialised drawing gd - no alpha and a color allocation bug; only 256 colors libart - a pesky clipping bug that the libart author has been unresponsive on; no subpixel rendering. no freetype2 support in paint (yet) agg - no significant 2D limitations. The same can be said for the native GUI drawing backends GTK and WX. My push to encourage people to use one of the agg backends for GUI or PNG is to get around the maintenance hassles associated with trying to support all these features across many backends. So my preference would be to 1) implement QTAgg and 2) try and port agg to the embedded device. The latter may not satisfy the size constraints for embedded devices (_backend_agg.so is around 600K on my box). But if you don't think these arguments are persuasive let me know. Especially if you would be willing to implement (and maintain) a console backend! JDH |
From: John H. <jdh...@ac...> - 2004-04-12 16:40:44
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes: Flavio> Hi John, Have you thought about writing a backend for Flavio> matplotlib that would display the plot in the console (no Flavio> X)? It could use the linux framebuffer or the SVGALib, Flavio> just like Links. Flavio> It would make it much more portable. What do you mean by portable? Both the linux framebuffer and svgalib are, as far as I know, linux only. JDH |
From: Flavio C. C. <fcc...@ci...> - 2004-04-12 16:04:36
|
If you're not intereste in creating a text file, The best way to go, is with pickle.dump and pickle.load Check the python docs about them. cheers, Fl=E1vio On Thu, 2004-04-08 at 17:38, Randy Heiland wrote: > What's the easiest way to write a Numeric array to a file? > Thanks! --Randy >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Gary R. <ga...@em...> - 2004-04-11 03:26:23
|
I just installed Gimp 2 for windows along with the latest GTK+ runtime and noticed that it exhibited the same font problem I've been experiencing for ages with matplotlib. I was getting WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8" errors. It's addressed in their FAQ, <http://www2.arnes.si/~sopjsimo/gimp/faq.html>, reproduced here: # I installed Gimp 2.0 on Windows 9x/ME or NT 4, and I'm getting a lot of messages saying ** (gimp-2.0.exe:4294830849): WARNING **: Couldn't load font "MS Sans Serif 8" falling back to "Sans 8". What should I do? # You have two options: * Go to Control Panel->Display properties->Apperance tab, and set all fonts to Tahoma (or any other TrueType font). * Uninstall GTK+ 2.2.4, then re-install it without the GTK-Wimp component. I took option B and now all is well with both Gimp and Matplotlib. I'm running Win98 and the Gimp FAQ entry hints that it may be a problem in Win98,ME and NT installations. It might be worth adding this to the Matplotlib faq page next to the "On windows with GTK, I'm getting lots of messages about not finding the Times font" entry. Gary -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Steve C. <ste...@ya...> - 2004-04-10 10:04:18
|
John, I plotted a graph with integer values along the x axis and panned the axis one step. I now had floating point labels along my integer x axis. Where did they come from? When running examples/simple_plot.py with axes.grid=True the gridlines divide the x axis into five 0.2 units. When I click on the "pan right" toolbar button I would expect to pan right one grid unit of 0.2. However, the example pans right by 0.167. I think the axis.pan() lines if numticks==0: numticks = 5 step = numsteps*self.viewlim.interval()/numticks should become if numticks==0: numticks = 6 step = numsteps*self.viewlim.interval()/(numticks-1) so that a one-step pan equals one grid unit. Regards Steve |