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
(12) |
2
(13) |
3
(14) |
4
(9) |
|
5
(9) |
6
(22) |
7
(17) |
8
(16) |
9
(19) |
10
(17) |
11
(6) |
|
12
|
13
(20) |
14
(21) |
15
(20) |
16
(10) |
17
(14) |
18
(3) |
|
19
(3) |
20
(12) |
21
(22) |
22
(26) |
23
(31) |
24
(26) |
25
(9) |
|
26
(4) |
27
(33) |
28
(15) |
29
(37) |
30
(26) |
|
|
|
From: Mark L. <lar...@gm...> - 2009-04-16 19:20:29
|
> I am not sure what you are asking -- could you elaborate? Sorry. I use matplotlib to create PNGs graphics for display on a web-page. I want to make the plots zoom-able. I'll use javascript to capture the pixel positions of the user's selected zoom region on the PNG plot. I'll then translate this into the coordinate system on the plot and redraw it with a new x, y range. I'm having trouble translating the initial axises into the pixel positions (essentially where they are on the PNG image). For example, I use the following code to map point positions from the coordinate system to pixel positions. I use an img map <MAP> to provide interaction with the actual lines. [CODE] lineObj = plt.plot(Xs,Ys,marker='o')[0] path, affine = lineObj._transformed_path.get_transformed_points_and_affine() path = affine.transform_path(path) for real,pixel in zip(lineObj.get_xydata(),path.vertices): ## write <AREA> tag for each point [/CODE] I'd like to get information similar to this for the axis of the plot. Thanks. |
|
From: Jeff W. <js...@fa...> - 2009-04-16 18:53:44
|
Josh Lawrence wrote: > Greetings all, > > In using the function griddata in mlab.py, I think I have found a bug. > The following line in mlab.py errors for me. > I supply it an xi and yi that have shape (N,1). I have surface data, > but I only care about the variation in one direction. In mlab, when it > gets to this line (2956 in svn revision 7040): > > if min(xo[1:]-xo[0:-1]) < 0 or min(yo[1:]-yo[0:-1]) < 0: > raise ValueError, 'output grid defined by xi,yi must be > monotone increasing' > > the result is an error. That is, I get the following: > > ValueError: min() arg is an empty sequence > > A couple of things. First, if I make my variation in x to be 2 points > (x = 0 for the case I'm interested in--so I just have both values of x > be zero), I do not get this error and I believe the result works. So, > it seems that there should be some handling of the case that there are > only 1 point in either x or y direction. > > Second, is it better to use the builtin python function min, or should > numpy.min be used instead? > > Cheers, > > Josh Lawrence > Ph.D. Student > Clemson University Josh: griddata currently only works for 2-D output grids. It may be possible to modify it to work with 1-D data, but that was not the original intent of the function. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: John H. <jd...@gm...> - 2009-04-16 18:21:56
|
On Thu, Apr 16, 2009 at 1:10 PM, Mark Larsen <lar...@gm...> wrote: > MPL Users, > > How can I get the matched max and min pixel/coordinate positions of my > x and y axises? I am not sure what you are asking -- could you elaborate? JDH |
|
From: Josh L. <jos...@gm...> - 2009-04-16 18:15:29
|
Greetings all,
In using the function griddata in mlab.py, I think I have found a bug.
The following line in mlab.py errors for me.
I supply it an xi and yi that have shape (N,1). I have surface data,
but I only care about the variation in one direction. In mlab, when it
gets to this line (2956 in svn revision 7040):
if min(xo[1:]-xo[0:-1]) < 0 or min(yo[1:]-yo[0:-1]) < 0:
raise ValueError, 'output grid defined by xi,yi must be
monotone increasing'
the result is an error. That is, I get the following:
ValueError: min() arg is an empty sequence
A couple of things. First, if I make my variation in x to be 2 points
(x = 0 for the case I'm interested in--so I just have both values of x
be zero), I do not get this error and I believe the result works. So,
it seems that there should be some handling of the case that there are
only 1 point in either x or y direction.
Second, is it better to use the builtin python function min, or should
numpy.min be used instead?
Cheers,
Josh Lawrence
Ph.D. Student
Clemson University
|
|
From: Mark L. <lar...@gm...> - 2009-04-16 18:10:54
|
MPL Users, How can I get the matched max and min pixel/coordinate positions of my x and y axises? Thanks, LarsenMTL |
|
From: Pim S. <P.S...@st...> - 2009-04-16 10:00:29
|
Dear matplotlib users/developers, I recently noticed that the errorbar funciton in the pyplot module changed it's default setting to fmt="-". This is a bit strange since this function is primarily used to display individual data points with measurement errors, drawing a line connecting the datapoints is not a common procedure and normally only done with a fit to the data. I think it makes much more sense if the default behaviour was fmt="+". Kind regards, Pim Schellart |
|
From: Andres L. <and...@ut...> - 2009-04-16 09:30:28
|
Images, one is directly png and other converted from eps.
Andres
Andres Luhamaa wrote:
> Hello!
> Following example will give strange result in postscript output. It does
> not happen, if I use imshow or contourf instead of pcolormesh and it
> seems to happen only with log scale.
>
> Best regards,
> Andres
>
> import numpy as np
> import matplotlib
> matplotlib.use( 'PS' )
> from mpl_toolkits.basemap import Basemap
> import os
> import pylab as plt
> import matplotlib.colors as colors
> m=Basemap(width=1500000,height=1000000,resolution='c',projection='stere',lon_0=\
> 17,lat_0=58)
> # geogr coords for
> points
> rx=np.arange(18,22,0.1)
> ry=np.arange(56,60,0.1)
> RX,RY=np.meshgrid(rx,ry)
> x,y=m(RX,RY)
> # create data for
> points
> data=np.zeros([rx.size,ry.size])
> data[:10,:10]=1e3
> m.pcolormesh(x,y,data
> ,norm=colors.LogNorm(vmin=50,vmax=17000.0)
> )
> m.drawcoastlines()
> m.drawcountries()
> m.drawmapboundary()
> plt.colorbar()
> plt.savefig('mapproblem.eps')
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Evan M. <eva...@gm...> - 2009-04-16 00:01:01
|
Hi, I want to put arrows onto the contours of a contour plot, the direction will depend on whether the contour is positive/negative. Before I try to do it myself, has anybody written something to do that? Thanks, Evan |
|
From: Christopher B. <c-...@as...> - 2009-04-15 23:08:18
|
Hi List, AS> now you're not loading the AS> graphical library that was grabbing focus, but merely a low(er) AS> level drawing library. This raises a question I've had for some time. I wish the figure method had x and y kwargs, so that I could specify where the figure window pops up. It always seems to pop up over my console, so that I have to move it to keep typing. It really breaks work flow. I also wish for something like a nofocus kwarg, that will tell the figure window to open in the background, so as not to grab focus. Again, this breaks work flow. This would be more like how Matlab figures behave. Although they popup to the foreground, you can continue typing and focus is correctly applied to the console. -- Christopher Brown, Ph.D. Department of Speech and Hearing Science Arizona State University |
|
From: Andres L. <and...@ut...> - 2009-04-15 21:15:15
|
Hello!
Following example will give strange result in postscript output. It does
not happen, if I use imshow or contourf instead of pcolormesh and it
seems to happen only with log scale.
Best regards,
Andres
import numpy as np
import matplotlib
matplotlib.use( 'PS' )
from mpl_toolkits.basemap import Basemap
import os
import pylab as plt
import matplotlib.colors as colors
m=Basemap(width=1500000,height=1000000,resolution='c',projection='stere',lon_0=\
17,lat_0=58)
# geogr coords for
points
rx=np.arange(18,22,0.1)
ry=np.arange(56,60,0.1)
RX,RY=np.meshgrid(rx,ry)
x,y=m(RX,RY)
# create data for
points
data=np.zeros([rx.size,ry.size])
data[:10,:10]=1e3
m.pcolormesh(x,y,data
,norm=colors.LogNorm(vmin=50,vmax=17000.0)
)
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary()
plt.colorbar()
plt.savefig('mapproblem.eps')
|
|
From: Michael D. <md...@st...> - 2009-04-15 18:38:28
|
I am not able to reproduce this leak here with 0.98.6svn from today on RHEL4. What platform are you on? (See attached massif profile -- the memory usage is flat...) Mike Jesper Larsen wrote: > Hi matplotlib developers and users, > > I have had some problems with a memory leak in a long running > matplotlib based web application that I have developed > (www.worldwildweather.com). I believe the problem is due to a memory > leak in the Agg backend but I am not sure. Below is a script which for > me results in a consistently increasing amount of memory usage. I am > using mpl version 0.98.6svn. The problem does not occur when the > savefig command is commented out. And it does not occur when "cs = > ax.contourf(z)" and "ax.cla()" are moved outside the loop (before and > after respectively). > > Best regards, > Jesper > > import os, gc > import numpy as npy > import matplotlib as mpl > from matplotlib.figure import Figure > from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas > > def report_memory(): > """Report memory.""" > gc.collect() > pid = os.getpid() > a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines() > return int(a2[1].split()[1]) > > fig = Figure(dpi=100) > ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) > FigureCanvas(fig) > > n = 1000 > z = npy.zeros((n,n)) > for i in range(2000): > cs = ax.contourf(z) > fig.savefig('test.png') > ax.cla() > print report_memory(), i > > I have not pasted in all of the output but just the first and last 25 lines: > 53356 0 > 53360 1 > 53360 2 > 53360 3 > 53360 4 > 53360 5 > 53360 6 > 53360 7 > 53360 8 > 53360 9 > 53360 10 > 53360 11 > 53360 12 > 53360 13 > 53360 14 > 53360 15 > 53360 16 > 53360 17 > 53356 18 > 53360 19 > 53360 20 > 53360 21 > 53360 22 > 53360 23 > 53356 24 > ... > 57552 1975 > 57552 1976 > 57552 1977 > 57552 1978 > 57552 1979 > 57552 1980 > 57552 1981 > 57552 1982 > 57552 1983 > 57552 1984 > 57552 1985 > 57552 1986 > 57552 1987 > 57552 1988 > 57552 1989 > 57552 1990 > 57552 1991 > 57552 1992 > 57552 1993 > 57552 1994 > 57552 1995 > 57552 1996 > 57552 1997 > 57552 1998 > 57552 1999 > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: Andrew S. <str...@as...> - 2009-04-15 15:48:36
|
Jeff Whitaker wrote: > Zane Selvans wrote: >> Is there a method built into Numpy/SciPy or friends that will generate >> a set of N points evenly (regularly - not randomly) sampling the >> entire surface of a sphere? I imagine people doing GCMs and other >> geoscience in spherical coordinates have to do this pretty frequently, >> so I'm sure someone's written it in Python somewhere. My searches >> aren't turning anything up immediately though. >> >> Thanks, >> Zane >> >> > Zane: This one has puzzled mathematicians for centuries - there is no > evenly spaced set of points on a sphere. The golden section spiral (or > fibonacci) points are easy to code (see code below), but don't form the > vertices of polygons. For modelling, where you need the points to be > vertices of polygons, hexagonal icosahedral grid are typically used (see > http://kiwi.atmos.colostate.edu/BUGS/geodesic/), but they are tricky to > compute (I don't have any python code handy). I'm attaching some code I wrote to subdivide and icosahedron for tiling a sphere with hexagons (and the occasional pentagon). -Andrew |
|
From: Jesper L. <jes...@gm...> - 2009-04-15 14:56:05
|
Hi matplotlib developers and users, I have had some problems with a memory leak in a long running matplotlib based web application that I have developed (www.worldwildweather.com). I believe the problem is due to a memory leak in the Agg backend but I am not sure. Below is a script which for me results in a consistently increasing amount of memory usage. I am using mpl version 0.98.6svn. The problem does not occur when the savefig command is commented out. And it does not occur when "cs = ax.contourf(z)" and "ax.cla()" are moved outside the loop (before and after respectively). Best regards, Jesper import os, gc import numpy as npy import matplotlib as mpl from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas def report_memory(): """Report memory.""" gc.collect() pid = os.getpid() a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines() return int(a2[1].split()[1]) fig = Figure(dpi=100) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) FigureCanvas(fig) n = 1000 z = npy.zeros((n,n)) for i in range(2000): cs = ax.contourf(z) fig.savefig('test.png') ax.cla() print report_memory(), i I have not pasted in all of the output but just the first and last 25 lines: 53356 0 53360 1 53360 2 53360 3 53360 4 53360 5 53360 6 53360 7 53360 8 53360 9 53360 10 53360 11 53360 12 53360 13 53360 14 53360 15 53360 16 53360 17 53356 18 53360 19 53360 20 53360 21 53360 22 53360 23 53356 24 ... 57552 1975 57552 1976 57552 1977 57552 1978 57552 1979 57552 1980 57552 1981 57552 1982 57552 1983 57552 1984 57552 1985 57552 1986 57552 1987 57552 1988 57552 1989 57552 1990 57552 1991 57552 1992 57552 1993 57552 1994 57552 1995 57552 1996 57552 1997 57552 1998 57552 1999 |
|
From: John H. <jd...@gm...> - 2009-04-15 13:16:52
|
On Wed, Apr 15, 2009 at 8:03 AM, Vito De Tullio <zak...@li...>wrote: > Gregor Thalhammer wrote: > > > I didn't understand what you mean by 'plot nodes' > > the markers, sorry > > > , but there exist > > figure_enter_event, figure_leave_event, axes_enter_event and > > axes_leave_event, see > > > > http://matplotlib.sourceforge.net/examples/event_handling/figure_axes_enter_leave.html > > first of all: why these *_enter_event and *_leave_event aren't in > > http://matplotlib.sourceforge.net/api/backend_bases_api.html#matplotlib.backend_bases.FigureCanvasBase.mpl_connect This is just a doc oversight -- I'll fix it. I think your solution is the right way to do it with the exiting mpl infrastructure, though one could use the "blit" api to make it a little more efficient to redraw just the needed artists rather than the whole figure each time (doing this would further complicate the code). Since you call your approach "ugly, and conceptually wrong", perhaps you can sketch what you think the right interface should be for something like this, and we will see if there is anything we can do within the existing mpl infrastructure to make it easier. FYI, check out the canvas.onHilite implementation, which shows how to use a hover to highlight individual artists (title, axes, xlabel, ylabel, ticklabel etc). This problem is a little easier, since what you are doing is triggering an action on artist B when artist A is hovered over. import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot(np.random.rand(10)) ax.set_title('hover over me') ax.set_xlabel('or me') ax.set_ylabel('or me') ax.grid() fig.canvas.mpl_connect('motion_notify_event', fig.canvas.onHilite) plt.show() JDH JDH |
|
From: Vito De T. <zak...@li...> - 2009-04-15 13:03:33
|
Gregor Thalhammer wrote: > I didn't understand what you mean by 'plot nodes' the markers, sorry > , but there exist > figure_enter_event, figure_leave_event, axes_enter_event and > axes_leave_event, see > http://matplotlib.sourceforge.net/examples/event_handling/figure_axes_enter_leave.html first of all: why these *_enter_event and *_leave_event aren't in http://matplotlib.sourceforge.net/api/backend_bases_api.html#matplotlib.backend_bases.FigureCanvasBase.mpl_connect second: they are cool, but I need to be more specific: I want to show some annotations only if I move my mouse pointer over a marker, and to make them disappear when I move my mouse pointer away (something like http://www.scipy.org/Cookbook/Matplotlib/Interactive_Plotting, but on mouse hovering) -- By ZeD |
|
From: Gregor T. <gre...@gm...> - 2009-04-15 12:45:54
|
Vito De Tullio schrieb: > Hi all. > I'm using matplotlib to draw some graph in a pyqt application. > Is there a way to show infos only when the mouse hover the plot nodes? > At the moment I'm stuck using this (ugly, and conceptually wrong) piece of > code, written by me... > > basically I add hidden annotations where I need, then (ab)use the > fig.canvas.mpl_connect function with the 'motion_notify_event' option. > > Is there a "motion_mouse_enter_plot" / "motion_mouse_exit_plot" or something > similar? I see there is the "pick_event" interface, but I don't want to > show infos "on click", but "on hovering" > I didn't understand what you mean by 'plot nodes', but there exist figure_enter_event, figure_leave_event, axes_enter_event and axes_leave_event, see http://matplotlib.sourceforge.net/examples/event_handling/figure_axes_enter_leave.html Gregor |
|
From: Vito De T. <zak...@li...> - 2009-04-15 12:10:56
|
Hi all.
I'm using matplotlib to draw some graph in a pyqt application.
Is there a way to show infos only when the mouse hover the plot nodes?
At the moment I'm stuck using this (ugly, and conceptually wrong) piece of
code, written by me...
basically I add hidden annotations where I need, then (ab)use the
fig.canvas.mpl_connect function with the 'motion_notify_event' option.
Is there a "motion_mouse_enter_plot" / "motion_mouse_exit_plot" or something
similar? I see there is the "pick_event" interface, but I don't want to
show infos "on click", but "on hovering"
#!/usr/bin/env python
class show_annotation(object):
def __init__(self, annotations):
'''"fake" class, mostly a "function with memory"'''
self.annotations = annotations
def __call__(self, mouse_event):
ax = mouse_event.inaxes
if not ax:
return
line = ax.get_lines()[0]
contained, infos = line.contains(mouse_event)
if not contained: # eventually exited
for annotation in self.annotations.values():
annotation.set_visible(False)
else:
xdata, ydata = line.get_data()
ind = infos['ind'][0]
annotation = self.annotations[xdata[ind], ydata[ind]]
if not annotation.get_visible(): # is entered
annotation.set_visible(True)
ax.figure.canvas.draw()
if __name__ == '__main__':
from random import randint
x = range(10)
y = [ randint(0, i) for i in x ]
labels = [ 'label_%d' % i for i in x ]
from matplotlib import pyplot
fig = pyplot.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(x, y)
# waiting for a "dict comprehension" sintax
annotations = {}
for label, xe, ye in zip(labels, x, y):
annotations[xe,ye] = ax.annotate(label, (xe,ye), visible=False)
fig.canvas.mpl_connect('motion_notify_event',
show_annotation(annotations))
pyplot.show()
--
By ZeD
|
|
From: Jeff W. <js...@fa...> - 2009-04-15 11:14:24
|
Zane Selvans wrote: > Is there a method built into Numpy/SciPy or friends that will generate > a set of N points evenly (regularly - not randomly) sampling the > entire surface of a sphere? I imagine people doing GCMs and other > geoscience in spherical coordinates have to do this pretty frequently, > so I'm sure someone's written it in Python somewhere. My searches > aren't turning anything up immediately though. > > Thanks, > Zane > > Zane: This one has puzzled mathematicians for centuries - there is no evenly spaced set of points on a sphere. The golden section spiral (or fibonacci) points are easy to code (see code below), but don't form the vertices of polygons. For modelling, where you need the points to be vertices of polygons, hexagonal icosahedral grid are typically used (see http://kiwi.atmos.colostate.edu/BUGS/geodesic/), but they are tricky to compute (I don't have any python code handy). Regards, -Jeff import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import sys # from http://www.xsi-blog.com/archives/115 def fibonacci(N): inc = np.pi * (3 - np.sqrt(5)) off = 2. / N r2d = 180./np.pi k = np.arange(0,N) y = k*off - 1. + 0.5*off r = np.sqrt(1 - y*y) phi = k * inc x = np.cos(phi)*r z = np.sin(phi)*r theta = np.arctan2(np.sqrt(x**2+y**2),z) phi = np.arctan2(y,x) lats = 90.-r2d*theta lons = r2d*phi return lats, lons npts = int(sys.argv[1]) lats, lons = fibonacci(npts) map = Basemap(projection ='ortho',lat_0=0,lon_0=-90) map.drawcoastlines() map.fillcontinents(color='coral') map.drawmapboundary(fill_color='aqua') x,y = map(lons, lats) map.scatter(x,y,10,marker='o',zorder=10) plt.show() |
|
From: Andres L. <and...@ut...> - 2009-04-15 09:29:50
|
Thanks Jeff, seems better indeed with svn version, at least resolution
'h' works (cant test the f resolution on a laptop). But when I zoom the
image 4x, then gv starts giving errors again. At the same time, evince
can show at the same zoom level.
Andres
Jeff Whitaker wrote:
> Andres Luhamaa wrote:
>> Hello!
>> I have a problem writing postscript output from a high resolution
>> map. It does not give any error, but output file gives a lot of
>> errors while I open it with gv. The following example works for
>> basemap resolution 'i', but not with resolution 'f'. Any ideas what I
>> should do in a different way or are there known limitations in PS or
>> a bug?
>>
>> Andres
>>
>
> Andres: Works for me (using SVN trunk), so the bug in the ps backend
> must have been fixed since the last release.
>
> -Jeff
>> #!/usr/bin/env
>> python
>> import numpy as np
>> import matplotlib
>> matplotlib.use( 'PS' )
>> from mpl_toolkits.basemap import Basemap
>> import os
>> import matplotlib.pyplot
>> import pylab as plt
>> import matplotlib.colors as colors
>> fig=plt.figure()
>> m=Basemap(llcrnrlon=0.83513989,llcrnrlat=53.49684419,urcrnrlon=55.00709304,urcr\
>>
>> nrlat=64.88386147,
>> projection='lcc',lat_0=60,lon_0=0.,
>> resolution ='i'
>> #
>> ,area_thresh=100.
>> )
>> m.drawcoastlines()
>> m.drawcountries()
>> m.drawmapboundary()
>> m.drawparallels([40,50,60,70],labels=[1,0,0,1])
>> m.drawmeridians([-160,-140,-120,-100,-80,-60,-40,-20,0,20,40,60,80,100,120,140,\
>>
>> 160,180],labels=[0,1,0,1])
>> plt.savefig('surfgeopot.eps')
>>
>>
>> ------------------------------------------------------------------------------
>>
>> This SF.net email is sponsored by:
>> High Quality Requirements in a Collaborative Environment.
>> Download a free trial of Rational Requirements Composer Now!
>> http://p.sf.net/sfu/www-ibm-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
|
|
From: Andrew K. <ndr...@gm...> - 2009-04-15 07:01:58
|
Hello,I am relatively new to matplotlib but I get the basics. What I need to do though is a slightly customized graph area. There are two plots on the same graph - a parabola and a straight line (with a negative slope) north east of the parabola. This graph has grid lines. Simple enough, but now I want to remove the graph area to the right of the line. Think of a dog-eared page in a book. Basically that top right triangle is gone. Can I do this in MPL or do I need to do some post processing in PIL? Much thanks for any help. -Andrew |
|
From: Zane S. <za...@id...> - 2009-04-15 06:51:42
|
Is there a method built into Numpy/SciPy or friends that will generate a set of N points evenly (regularly - not randomly) sampling the entire surface of a sphere? I imagine people doing GCMs and other geoscience in spherical coordinates have to do this pretty frequently, so I'm sure someone's written it in Python somewhere. My searches aren't turning anything up immediately though. Thanks, Zane -- Zane A. Selvans Amateur Earthling http://zaneselvans.org +1 303 815 6866 |
|
From: Andrew S. <str...@as...> - 2009-04-15 05:38:31
|
Tyler B wrote: > I think that did it --- thanks Andrew!! > > Just out of curiosity, what does 'Agg' refer to? It's the low-level drawing library, anti-grain. You're bypassing the loading of whatever other "backend" -- a low-level drawing system -- that matplotlib was loading before. Also, I'm guessing > that some efficiency is lost once we make Python import the entire > library (as opposed to just pyplot as before) -- is there a more > efficient way, or is that just the price to pay? Actually, I'd guess it's the opposite -- now you're not loading the graphical library that was grabbing focus, but merely a low(er) level drawing library. -Andrew |
|
From: Tyler B <tbo...@gm...> - 2009-04-15 05:21:49
|
I think that did it --- thanks Andrew!! Just out of curiosity, what does 'Agg' refer to? Also, I'm guessing that some efficiency is lost once we make Python import the entire library (as opposed to just pyplot as before) -- is there a more efficient way, or is that just the price to pay? Either way, thanks a ton! Tyler On 4/15/09, Andrew Straw <str...@as...> wrote: > Tyler B wrote: >> Hi there, >> >> I am trying to run a python script on my computer at a regular >> interval [in the background] to output an image file using >> matplotlib. My problem is that every time the script runs, it >> momentarily steals focus from whatever I'm working on -- which over >> time gets to be very annoying. >> >> I think that I've narrowed it down to a single line in the python script: >> fig = plt.figure(facecolor ='w', frameon=False) >> >> [note that I've imported matplotlib.pyplot as plt earlier] >> >> I made a short video to show the problem: >> http://screencast.com/t/MRObeKrx >> >> Can anyone think of a good way to prevent matplotlib from stealing >> focus?? This is the last problem I have to solve.. though I'm out of >> ideas. > You don't show the beginning of your script, but try: > > import matplotlib > matplotlib.use('Agg') > > before any other MPL imports. > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Andrew S. <str...@as...> - 2009-04-15 05:06:36
|
Tyler B wrote: > Hi there, > > I am trying to run a python script on my computer at a regular > interval [in the background] to output an image file using > matplotlib. My problem is that every time the script runs, it > momentarily steals focus from whatever I'm working on -- which over > time gets to be very annoying. > > I think that I've narrowed it down to a single line in the python script: > fig = plt.figure(facecolor ='w', frameon=False) > > [note that I've imported matplotlib.pyplot as plt earlier] > > I made a short video to show the problem: > http://screencast.com/t/MRObeKrx > > Can anyone think of a good way to prevent matplotlib from stealing > focus?? This is the last problem I have to solve.. though I'm out of > ideas. You don't show the beginning of your script, but try: import matplotlib matplotlib.use('Agg') before any other MPL imports. |
|
From: C M <cmp...@gm...> - 2009-04-15 03:47:10
|
Thanks, Ryan, John, and Pierre... I will try to change it at the point John suggests, maybe inspired by scikits.timeseries (or just using it). btw, I think adding the ability to set the AutoDateFormat formatting choices per scale would be a good small addition to mpl. (Maybe that is what the commented lines in the class are about, but I don't quite understand them). Methods like .set_dayscale_format, .set_weekscale_format, etc. Thanks, Che |