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
(7) |
|
2
(5) |
3
(18) |
4
(9) |
5
(13) |
6
(14) |
7
(8) |
8
(7) |
|
9
(6) |
10
(6) |
11
(24) |
12
(14) |
13
(9) |
14
(21) |
15
(6) |
|
16
(1) |
17
(20) |
18
(42) |
19
(16) |
20
(21) |
21
(41) |
22
(13) |
|
23
(11) |
24
(15) |
25
(32) |
26
(27) |
27
(29) |
28
(10) |
29
(3) |
|
30
(1) |
31
(5) |
|
|
|
|
|
|
From: Chiara C. <chi...@ho...> - 2008-03-08 15:17:56
|
Hello, I am also interested in masking polygons and defining the polygon by 'clicking' on the image... but I do not know anything about GUI.... does anyone can help? Is there already something implemented? Thanks! Chiara > Date: Wed, 23 Jan 2008 13:50:15 +1300 > From: am...@gm... > To: mat...@li... > Subject: Re: [Matplotlib-users] Polygon masking possible? > > Hi Søren, > > I've put this back on the list in case it's useful to anyone else, or > if there are better suggestions or improvements around. Hope you don't > mind. > > On 22/01/2008, Søren Nielsen <sor...@gm...> wrote: > > Yeah i'd like to see your code if I can.. > > import numpy as n > > def get_poly_pts(x, y, shape): > """Creates convex polygon mask from list of corners. > > Parameters > ---------- > x : array_like > x co-ordinates of corners > y : array_like > y co-ordinates of corners, in order corresponding to x > shape : array_like > dimension sizes of result > > Returns > ------- > build : ndarray > 2-D array of shape shape with values True inside polygon > > Notes > ----- > Code is constrained to convex polygons by "inside" > assessment criterion. > > """ > x = n.asarray(x) > y = n.asarray(y) > shape = n.asarray(shape) > npts = x.size # should probably assert x.size == y.size > inds = n.indices( shape ) > xs = inds[0] > ys = inds[1] > xav = n.round(x.mean()).astype(int) > yav = n.round(y.mean()).astype(int) > for i in xrange(npts): # iterate over pairs of co-ordinates > j = (i + 1) % npts > m = (y[j] - y[i])/(x[j] - x[i]) > c = (x[j] * y[i] - x[i] * y[j])/(x[j] - x[i]) > thisone = ( ys > m * xs + c ) > if thisone[xav, yav] == False: > thisone = ~thisone > if i == 0: > build = thisone > else: > build &= thisone > return build > > (released under BSD licence) > > > I just needed the push over the edge to know how to draw on the canvas, > > mapping clicks etc. since i'm still fairly new to matplotlib, so I think > > your code will be helpfull. > > I hope so. As you can see this code doesn't do any of the drawing or > click collecting, but the cookbook page should be able to guide you > there. Ask again on the list if you have any further questions and > we'll see if we can help. > > Also, the code assumes that the average co-ordinate is inside the > shape - that's true for convex polygons, but not necessarily for > arbitrary ones. I use if after taking a convex hull of a greater list > of points (using the delaunay module in scipy (now in scikits, I > hear)), which ensures convexity. You just need to be aware of that > limitation. > > Cheers, > > A. > -- > AJC McMorland, PhD candidate > Physiology, University of Auckland > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
|
From: Eric F. <ef...@ha...> - 2008-03-08 15:16:30
|
Ryan, See examples/colorbar_only.py. I think it illustrates what you want. Eric Ryan May wrote: > Hi, > > In working on creating updating pcolor plots, I noticed that I can't > create colorbars (which should be static) without first displaying an > image. I have a fixed Normalize object and colormap, so I would think > that the colorbar wouldn't actually need any information from the image > itself. > > Is there any to create a colorbar without first actually plotting an > image? If not, is there any reason colorbar couldn't be modified to > work using only a norm and a cmap? > > Thanks, > > Ryan > |
|
From: Ryan M. <rm...@ou...> - 2008-03-07 21:27:12
|
Hi, In working on creating updating pcolor plots, I noticed that I can't create colorbars (which should be static) without first displaying an image. I have a fixed Normalize object and colormap, so I would think that the colorbar wouldn't actually need any information from the image itself. Is there any to create a colorbar without first actually plotting an image? If not, is there any reason colorbar couldn't be modified to work using only a norm and a cmap? Thanks, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |
|
From: Michael D. <md...@st...> - 2008-03-07 19:40:41
|
Am I correct that you would like to add new kinds of plots to matplotlib that transform the raw data in some new way? Though transforms are involved, at the higher level you see this referred to as "projections" a lot in the mpl code. There are a number of approaches you could take, all of which have different tradeoffs, rather than there being one "Right Way". In matplotlib-0.91 (and earlier) there is an underlying framework for doing transformations (in _transforms.cpp). This framework, while its does it job well, is kind of obscure and difficult to extend with new kinds of transformations. But it's certainly doable, and you can look at the code for polar plots (in axes.py) for an example. As a result, the current SVN trunk has been heavily refactored to make adding new kinds of projections easier. I'm biased because I did a lot of that work, so I wouldn't want to claim that it is significantly easier until someone else comes along and uses the new framework to build something new. (I think the soil texture triangle plot you suggest seems like it would be a reasonably good fit, though). If you decide to take this approach, there is documentation for making new projections here: http://matplotlib.svn.sourceforge.net/viewvc/*checkout*/matplotlib/trunk/matplotlib/doc/devel/add_new_projection.rst Again, that documentation has largely gone unused by anyone but myself, so please let me know where it needs improvement. Of course, the downside is that it may be a number of months until the SVN trunk is released as a stable version. Alternatively to all of the above, you could take the approach of "basemap" (a toolkit extension to matplotlib). It (essentially) does all of the transformation of the data into a given projection internally and then passes that along as a regular Cartesian 2D plot to matplotlib. That approach does work well, and has shown to be rather robust to internal changes in mpl, since it primarily uses the "public" (and more stable) APIs. Hope that helps. Please ask if you have any more questions as you go. Mike Chloe Lewis wrote: > I stick to releases, so, 0.91.2; although if the transforms are about > to change a lot, maybe I'll put off the 'right way'. > > The first thing I'm writing is an easy version of the 'soil texture > triangle' -- plotting x+y+z=100, but on an equilateral triangle: > > http://www.uwsp.edu/geo/faculty/ritter/glossary/s_u/soil_texture_triangle.html > > > Scatters and patches on this are handy. > > There's another handful of triangular, sort-of-rigorous 3-variable > graphs commonly used by ecosystem scientists, which I'd like to extend > to. > > &C > > > On Mar 7, 2008, at 7 Mar, 10:30 AM, Michael Droettboom wrote: > >> Can you be a bit more specific about what you're trying to do? (Are >> you working with the latest SVN trunk, or the latest release 0.91.x? >> The two are considerably different wrt to the transforms framework(s)). >> >> Cheers, >> Mike >> >> Chloe Lewis wrote: >>> Any current transforms examples? The transforms docs suggest >>> looking in /units for transforms examples; the current matplotlib >>> examples has /units without transforms. (I want something a bit >>> more detailed than the offset.) >>> >>> If the transforms are currently too much in flux, I'll do something >>> one-off, but I'd like to do it the Right Way if I can. >>> >>> &C >>> >>> >>> >>> >>> ------------------------------------------------------------------------- >>> >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2008. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> 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 >> > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: Michael D. <md...@st...> - 2008-03-07 18:30:40
|
Can you be a bit more specific about what you're trying to do? (Are you working with the latest SVN trunk, or the latest release 0.91.x? The two are considerably different wrt to the transforms framework(s)). Cheers, Mike Chloe Lewis wrote: > Any current transforms examples? The transforms docs suggest looking > in /units for transforms examples; the current matplotlib examples > has /units without transforms. (I want something a bit more detailed > than the offset.) > > If the transforms are currently too much in flux, I'll do something > one-off, but I'd like to do it the Right Way if I can. > > &C > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > 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: Chloe L. <cl...@te...> - 2008-03-07 18:25:18
|
Any current transforms examples? The transforms docs suggest looking in /units for transforms examples; the current matplotlib examples has /units without transforms. (I want something a bit more detailed than the offset.) If the transforms are currently too much in flux, I'll do something one-off, but I'd like to do it the Right Way if I can. &C |
|
From: Jeff P. <jef...@ya...> - 2008-03-07 15:43:04
|
Hello, I just upgraded to the most recent version of matplotlib. I'm trying to freeze my wx app with py2exe. I'm getting this error:
error: cannot copy ...mpl-data/matplotlib.nib. doesn't exist or is not a regular file
how do I correct this error? thanks!
Jeff
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. |
|
From: John H. <jd...@gm...> - 2008-03-07 12:21:29
|
On Fri, Mar 7, 2008 at 2:48 AM, Troels Kofoed Jacobsen <tkj...@gm...> wrote: > Hi all > > Can i make something transparent? > > E.g the markerfacecolor? Set the alpha to a value less than one, eg ax.plot(something, mfc='green', alpha=0.5) JDH |
|
From: Chris W. <ch...@si...> - 2008-03-07 09:11:12
|
Hi All,
Apologies if I'm missing anything obvious...
How do I plot lines point-by-point as opposed to by passing arrays?
I'm guessing something like:
plot([x],[y])
...but that feels a bit weird to me.
In any case, using that, I don't know how to plot more than one line at
a time, so thought I'd ask here...
Hope you can help!
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
|
|
From: Troels K. J. <tkj...@gm...> - 2008-03-07 08:49:06
|
Hi all Can i make something transparent? E.g the markerfacecolor? -- Med Venlig Hilsen /Best Regards Troels Kofoed Jacobsen |
|
From: Tommy G. <tg...@ma...> - 2008-03-06 18:42:10
|
I have an array of 0s and 1s and plot it with imshow. Is there a way to set the 0 part only to have a transparency (alpha)? Cheers Tommy |
|
From: Jeff W. <js...@fa...> - 2008-03-06 18:27:38
|
Stephane Raynaud wrote: > On Thu, Mar 6, 2008 at 6:15 PM, Jeff Whitaker <js...@fa...> wrote: > >> Stephane Raynaud wrote: >> > Hi, >> > >> > this scalebar is a really good idea! >> > >> > However, I suggest that all parameters must be optional: >> > - The position could be by default somewhere in the lower left corner >> > (for example). It may be interesting to find a "best" position using >> > the algo of legend. >> > - Then length could be estimated from automatically from the map coordinates. >> > >> > >> > >> Stephane: While I agree it would be nice to be able to just say 'give >> me a scalebar', I don't think having Basemap choose a default location >> and size would be very useful. You want the scalebar to be where there >> is nothing else drawn on the map, and this will be different in every >> case. >> > > Sure, but the algorithm used by legend tries to put the legend where > there is nothing drawn. > > > >> Plus, you probably want the length to be a nice round number, not >> an arbitrary fraction of the map domain. >> > > I was not thinking about a simple fraction, but a nice length taken > within values derived from a Locator scaled by a fraction on the map > domain. > > Stephane: Sounds reasonable, but I don't have time to work on this now. Patches are always welcome! (including your caching module) -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
|
From: Stephane R. <ste...@gm...> - 2008-03-06 18:05:01
|
On Thu, Mar 6, 2008 at 6:15 PM, Jeff Whitaker <js...@fa...> wrote:
> Stephane Raynaud wrote:
> > Hi,
> >
> > this scalebar is a really good idea!
> >
> > However, I suggest that all parameters must be optional:
> > - The position could be by default somewhere in the lower left corner
> > (for example). It may be interesting to find a "best" position using
> > the algo of legend.
> > - Then length could be estimated from automatically from the map coordinates.
> >
> >
> >
> Stephane: While I agree it would be nice to be able to just say 'give
> me a scalebar', I don't think having Basemap choose a default location
> and size would be very useful. You want the scalebar to be where there
> is nothing else drawn on the map, and this will be different in every
> case.
Sure, but the algorithm used by legend tries to put the legend where
there is nothing drawn.
> Plus, you probably want the length to be a nice round number, not
> an arbitrary fraction of the map domain.
I was not thinking about a simple fraction, but a nice length taken
within values derived from a Locator scaled by a fraction on the map
domain.
>
> -Jeff
>
>
> > On Tue, Mar 4, 2008 at 3:47 PM, Michael Hearne <mh...@us...> wrote:
> >
> >> Jeff - I think the way GMT does it would be okay - they have a latitude of
> >> true scale, which I usually choose as the center latitude of the map.
> >>
> >> I was thinking we should allow people to choose the "simple" or "fancy"
> >> options. Do you think it will be okay to have the height of the bar and the
> >> text offset be relative to the length of it? I suppose if the height
> >> becomes a problem, people could use the yoffset keyword...
> >>
> >> --Mike
> >>
> >>
> >> On Mar 4, 2008, at 6:05 AM, Jeff Whitaker wrote:
> >>
> >> Michael Hearne wrote:
> >> Jeff - That would replicate the "simple" scale-bar from GMT. Below is my
> >> not-complete attempt at replicating the "fancy" scale bar. It would need
> >> some options for specifying different units (miles, nautical miles, etc.)
> >> and perhaps some more attention to spacing of the text from the scale bar
> >> and tick marks...
> >>
> >> --Mike
> >>
> >> Mike: Very nice! Do you want the scale to show the true distance on the
> >> earth (in which case the labels will vary depending on where the label is
> >> placed), or the distance in map projection coordinates (in which case the
> >> labels are constant)? Or perhaps a lat/lon value could be given to specify
> >> where the scale is true?
> >>
> >> -Jeff
> >>
> >> from numpy import *
> >> from matplotlib.toolkits.basemap import Basemap, pyproj
> >> from pylab import *
> >> # add drawscale method to Basemap class.
> >> class Basemap2(Basemap):
> >> def drawscale(self,lon,lat,length,yoffset=None):
> >> """draw a fancy map scale from lon-length/2,lat-yoffset to
> >> lon-length/2,lat-yoffset, label it with actual distance in km"""
> >> length = length*1000 #input length is km
> >>
> >> #we need 5 sets of x coordinates (in map units)
> >> #center of scale
> >> xc,yc = self(lon,lat)
> >> #left edge of scale
> >> lon1,lat1 = self(xc-length/2,yc,inverse=True)
> >> x1,y1 = self(lon1,lat1)
> >> #quarter scale
> >> lon2,lat2 = self(xc-length/4,yc,inverse=True)
> >> x2,y2 = self(lon2,lat2)
> >> #three quarter scale
> >> lon3,lat3 = self(xc+length/4,yc,inverse=True)
> >> x3,y3 = self(lon3,lat3)
> >> #right edge of scale
> >> lon4,lat4 = self(xc+length/2,yc,inverse=True)
> >> x4,y4 = self(lon4,lat4)
> >> if yoffset is None: yoffset = 0.1*length
> >>
> >> #plot top line
> >> ytop = yc+yoffset/2
> >> ybottom = yc-yoffset/2
> >> ytick = ybottom - yoffset/2
> >> ytext = ytick - yoffset/2
> >> m.plot([x1,x4],[ytop,ytop],color='k')
> >> #plot bottom line
> >> m.plot([x1,x4],[ybottom,ybottom],color='k')
> >> #plot left edge
> >> m.plot([x1,x1],[ybottom,ytop],color='k')
> >> #plot right edge
> >> m.plot([x4,x4],[ybottom,ytop],color='k')
> >>
> >> #make a filled black box from left edge to 1/4 way across
> >> fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],'k')
> >> #make a filled white box from 1/4 way across to 1/2 way across
> >> fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],'w')
> >> #make a filled white box from 1/2 way across to 3/4 way across
> >> fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],'k')
> >> #make a filled white box from 3/4 way across to end
> >> fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],'w')
> >> #plot 3 tick marks at left edge, center, and right edge
> >> m.plot([x1,x1],[ytick,ybottom],color='k')
> >> m.plot([xc,xc],[ytick,ybottom],color='k')
> >> m.plot([x4,x4],[ytick,ybottom],color='k')
> >>
> >> #label 3 tick marks
> >> text(x1,ytext,'%d' % (0),\
> >> horizontalalignment='center',\
> >> verticalalignment='top',\
> >> fontsize=9)
> >> text(xc,ytext,'%d' % (round((length/2)/1000)),\
> >> horizontalalignment='center',\
> >> verticalalignment='top',\
> >> fontsize=9)
> >> text(x4,ytext,'%d' % (round((length)/1000)),\
> >> horizontalalignment='center',\
> >> verticalalignment='top',\
> >> fontsize=9)
> >>
> >> #put units on top
> >> text(xc,ytop+yoffset/2,'km',\
> >> horizontalalignment='center',\
> >> verticalalignment='bottom',\
> >> fontsize=9)
> >>
> >> # setup of basemap ('lcc' = lambert conformal conic).
> >> # use major and minor sphere radii from WGS84 ellipsoid.
> >> m =
> >> Basemap2(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
> >> rsphere=(6378137.00,6356752.3142),\
> >> resolution='l',area_thresh=1000.,projection='lcc',\
> >> lat_1=50.,lon_0=-107.)
> >> # draw coastlines and political boundaries.
> >> m.drawcoastlines()
> >> m.fillcontinents()
> >> # draw parallels and meridians.
> >> # label on left, right and bottom of map.
> >> m.drawparallels(arange(0.,80,20.),labels=[1,1,0,1])
> >> m.drawmeridians(arange(10.,360.,30.),labels=[1,1,0,1])
> >> # draw a line from x1,y to x2,y and label it with distance in km.
> >> length = 3000 #kilometers
> >> x1,y1 = 0.25*m.xmax, 0.25*m.ymax
> >> lon1,lat1 = m(x1,y1,inverse=True)
> >> m.drawscale(lon1,lat1,length)
> >> title('a fancy map scale')
> >> show()
> >>
> >>
> >>
> >>
> >> ------------------------------------------------------
> >> Michael Hearne
> >> mh...@us... <mailto:mh...@us...>
> >> (303) 273-8620
> >> USGS National Earthquake Information Center
> >> 1711 Illinois St. Golden CO 80401
> >> Senior Software Engineer
> >> Synergetics, Inc.
> >> ------------------------------------------------------
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Jeffrey S. Whitaker Phone : (303)497-6313
> >> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
> >> 325 Broadway Boulder, CO, USA 80305-3328
> >>
> >>
> >>
> >>
> >>
> >> ------------------------------------------------------
> >> Michael Hearne
> >> mh...@us...
> >> (303) 273-8620
> >> USGS National Earthquake Information Center
> >> 1711 Illinois St. Golden CO 80401
> >> Senior Software Engineer
> >> Synergetics, Inc.
> >> ------------------------------------------------------
> >>
> >>
> >> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2008.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >>
> >>
> >
> >
> >
> >
>
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
> 325 Broadway Boulder, CO, USA 80305-3328
>
>
--
Stephane Raynaud
|
|
From: Kevin C. <kch...@ya...> - 2008-03-06 17:18:56
|
When errorbar() and legend(loc='best') are used an error message appears. But other legend locations (e.g. 'upper left' or 'upper right') work fine.
pylab.figure()
pylab.errorbar(xdata,ydata,z*y_standardError,fmt='o-',label='test')
pylab.legend(loc='best')
pylab.show()
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
return self.func(*args)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 188, in resize
self.show()
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 191, in draw
FigureCanvasAgg.draw(self)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", line 358, in draw
self.figure.draw(self.renderer)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 624, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1345, in draw
a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\legend.py", line 236, in draw
self._update_positions(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\legend.py", line 579, in _update_positions
ox, oy = self._find_best_position(w, h)
File "C:\Python25\Lib\site-packages\matplotlib\legend.py", line 463, in _find_best_position
verts, bboxes, lines = self._auto_legend_data()
File "C:\Python25\Lib\site-packages\matplotlib\legend.py", line 378, in _auto_legend_data
hlines = handle.get_lines()
AttributeError: LineCollection instance has no attribute 'get_lines'
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs |
|
From: Jeff W. <js...@fa...> - 2008-03-06 17:16:48
|
Stephane Raynaud wrote:
> Hi,
>
> this scalebar is a really good idea!
>
> However, I suggest that all parameters must be optional:
> - The position could be by default somewhere in the lower left corner
> (for example). It may be interesting to find a "best" position using
> the algo of legend.
> - Then length could be estimated from automatically from the map coordinates.
>
>
>
Stephane: While I agree it would be nice to be able to just say 'give
me a scalebar', I don't think having Basemap choose a default location
and size would be very useful. You want the scalebar to be where there
is nothing else drawn on the map, and this will be different in every
case. Plus, you probably want the length to be a nice round number, not
an arbitrary fraction of the map domain.
-Jeff
> On Tue, Mar 4, 2008 at 3:47 PM, Michael Hearne <mh...@us...> wrote:
>
>> Jeff - I think the way GMT does it would be okay - they have a latitude of
>> true scale, which I usually choose as the center latitude of the map.
>>
>> I was thinking we should allow people to choose the "simple" or "fancy"
>> options. Do you think it will be okay to have the height of the bar and the
>> text offset be relative to the length of it? I suppose if the height
>> becomes a problem, people could use the yoffset keyword...
>>
>> --Mike
>>
>>
>> On Mar 4, 2008, at 6:05 AM, Jeff Whitaker wrote:
>>
>> Michael Hearne wrote:
>> Jeff - That would replicate the "simple" scale-bar from GMT. Below is my
>> not-complete attempt at replicating the "fancy" scale bar. It would need
>> some options for specifying different units (miles, nautical miles, etc.)
>> and perhaps some more attention to spacing of the text from the scale bar
>> and tick marks...
>>
>> --Mike
>>
>> Mike: Very nice! Do you want the scale to show the true distance on the
>> earth (in which case the labels will vary depending on where the label is
>> placed), or the distance in map projection coordinates (in which case the
>> labels are constant)? Or perhaps a lat/lon value could be given to specify
>> where the scale is true?
>>
>> -Jeff
>>
>> from numpy import *
>> from matplotlib.toolkits.basemap import Basemap, pyproj
>> from pylab import *
>> # add drawscale method to Basemap class.
>> class Basemap2(Basemap):
>> def drawscale(self,lon,lat,length,yoffset=None):
>> """draw a fancy map scale from lon-length/2,lat-yoffset to
>> lon-length/2,lat-yoffset, label it with actual distance in km"""
>> length = length*1000 #input length is km
>>
>> #we need 5 sets of x coordinates (in map units)
>> #center of scale
>> xc,yc = self(lon,lat)
>> #left edge of scale
>> lon1,lat1 = self(xc-length/2,yc,inverse=True)
>> x1,y1 = self(lon1,lat1)
>> #quarter scale
>> lon2,lat2 = self(xc-length/4,yc,inverse=True)
>> x2,y2 = self(lon2,lat2)
>> #three quarter scale
>> lon3,lat3 = self(xc+length/4,yc,inverse=True)
>> x3,y3 = self(lon3,lat3)
>> #right edge of scale
>> lon4,lat4 = self(xc+length/2,yc,inverse=True)
>> x4,y4 = self(lon4,lat4)
>> if yoffset is None: yoffset = 0.1*length
>>
>> #plot top line
>> ytop = yc+yoffset/2
>> ybottom = yc-yoffset/2
>> ytick = ybottom - yoffset/2
>> ytext = ytick - yoffset/2
>> m.plot([x1,x4],[ytop,ytop],color='k')
>> #plot bottom line
>> m.plot([x1,x4],[ybottom,ybottom],color='k')
>> #plot left edge
>> m.plot([x1,x1],[ybottom,ytop],color='k')
>> #plot right edge
>> m.plot([x4,x4],[ybottom,ytop],color='k')
>>
>> #make a filled black box from left edge to 1/4 way across
>> fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],'k')
>> #make a filled white box from 1/4 way across to 1/2 way across
>> fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],'w')
>> #make a filled white box from 1/2 way across to 3/4 way across
>> fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],'k')
>> #make a filled white box from 3/4 way across to end
>> fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],'w')
>> #plot 3 tick marks at left edge, center, and right edge
>> m.plot([x1,x1],[ytick,ybottom],color='k')
>> m.plot([xc,xc],[ytick,ybottom],color='k')
>> m.plot([x4,x4],[ytick,ybottom],color='k')
>>
>> #label 3 tick marks
>> text(x1,ytext,'%d' % (0),\
>> horizontalalignment='center',\
>> verticalalignment='top',\
>> fontsize=9)
>> text(xc,ytext,'%d' % (round((length/2)/1000)),\
>> horizontalalignment='center',\
>> verticalalignment='top',\
>> fontsize=9)
>> text(x4,ytext,'%d' % (round((length)/1000)),\
>> horizontalalignment='center',\
>> verticalalignment='top',\
>> fontsize=9)
>>
>> #put units on top
>> text(xc,ytop+yoffset/2,'km',\
>> horizontalalignment='center',\
>> verticalalignment='bottom',\
>> fontsize=9)
>>
>> # setup of basemap ('lcc' = lambert conformal conic).
>> # use major and minor sphere radii from WGS84 ellipsoid.
>> m =
>> Basemap2(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
>> rsphere=(6378137.00,6356752.3142),\
>> resolution='l',area_thresh=1000.,projection='lcc',\
>> lat_1=50.,lon_0=-107.)
>> # draw coastlines and political boundaries.
>> m.drawcoastlines()
>> m.fillcontinents()
>> # draw parallels and meridians.
>> # label on left, right and bottom of map.
>> m.drawparallels(arange(0.,80,20.),labels=[1,1,0,1])
>> m.drawmeridians(arange(10.,360.,30.),labels=[1,1,0,1])
>> # draw a line from x1,y to x2,y and label it with distance in km.
>> length = 3000 #kilometers
>> x1,y1 = 0.25*m.xmax, 0.25*m.ymax
>> lon1,lat1 = m(x1,y1,inverse=True)
>> m.drawscale(lon1,lat1,length)
>> title('a fancy map scale')
>> show()
>>
>>
>>
>>
>> ------------------------------------------------------
>> Michael Hearne
>> mh...@us... <mailto:mh...@us...>
>> (303) 273-8620
>> USGS National Earthquake Information Center
>> 1711 Illinois St. Golden CO 80401
>> Senior Software Engineer
>> Synergetics, Inc.
>> ------------------------------------------------------
>>
>>
>>
>>
>>
>> --
>> Jeffrey S. Whitaker Phone : (303)497-6313
>> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
>> 325 Broadway Boulder, CO, USA 80305-3328
>>
>>
>>
>>
>>
>> ------------------------------------------------------
>> Michael Hearne
>> mh...@us...
>> (303) 273-8620
>> USGS National Earthquake Information Center
>> 1711 Illinois St. Golden CO 80401
>> Senior Software Engineer
>> Synergetics, Inc.
>> ------------------------------------------------------
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>
>
>
>
--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
|
|
From: Jeff W. <js...@fa...> - 2008-03-06 17:06:00
|
Tommy Grav wrote: > Thanks for pointing this function out. I thought I had look for it, > but must have overlooked it. > > I am using the test code below, but the array is plotted outside the > boundary of the map. Is there > a way to avoid this? > > Cheers > Tommy > > from math import * > from matplotlib.toolkits.basemap import Basemap > import pylab > import numpy > > rabins = numpy.arange(0.,360.,6) > decbins = numpy.arange(-90.,90.,6) > map = Basemap(projection="sinu",lat_0=0.,lon_0=180.,rsphere=1.) > > coverage = numpy.zeros([len(decbins),len(rabins)],"int") > > coverage[0:5,:] = 2 > coverage[5:10,:] = 4 > > > map.imshow(coverage,interpolation="nearest",cmap=pylab.cm.hot_r) > map.drawmapboundary() > > pylab.show() > > > > > On Mar 6, 2008, at 11:10 AM, Jeff Whitaker wrote: > > >> Tommy Grav wrote: >> >>> Is there a way of using imshow together with a basemap? >>> >>> Cheers >>> Tommy >>> >>> >> Tommy: >> >> Use the imshow basemap method, just as you would the pylab version. >> >> -Jeff >> >> Tommy: You're using a non-rectangular map projection, so imshow won't work. Try pcolor or pcolormesh instead, i.e. replace map.imshow with: rabins, decbins = numpy.meshgrid(rabins, decbins) x,y = map(rabins,decbins) map.pcolor(x,y,coverage,cmap=pylab.cm.hot_r) -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
|
From: Tommy G. <tg...@ma...> - 2008-03-06 16:49:42
|
Thanks for pointing this function out. I thought I had look for it,
but must have overlooked it.
I am using the test code below, but the array is plotted outside the
boundary of the map. Is there
a way to avoid this?
Cheers
Tommy
from math import *
from matplotlib.toolkits.basemap import Basemap
import pylab
import numpy
rabins = numpy.arange(0.,360.,6)
decbins = numpy.arange(-90.,90.,6)
map = Basemap(projection="sinu",lat_0=0.,lon_0=180.,rsphere=1.)
coverage = numpy.zeros([len(decbins),len(rabins)],"int")
coverage[0:5,:] = 2
coverage[5:10,:] = 4
map.imshow(coverage,interpolation="nearest",cmap=pylab.cm.hot_r)
map.drawmapboundary()
pylab.show()
On Mar 6, 2008, at 11:10 AM, Jeff Whitaker wrote:
> Tommy Grav wrote:
>> Is there a way of using imshow together with a basemap?
>>
>> Cheers
>> Tommy
>>
> Tommy:
>
> Use the imshow basemap method, just as you would the pylab version.
>
> -Jeff
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
> 325 Broadway Boulder, CO, USA 80305-3328
>
|
|
From: Jeff W. <js...@fa...> - 2008-03-06 16:17:27
|
Stephane Raynaud wrote: > Hi > > Jeff: how about introducing a cache system for Basemap objects? > > You recently gave me the idea of using cPickle on Basemap objects, so > I implement a very simple cache system that try to check if map has > already been serialized and dumped to a cache file, before trying to > create it from scratch. Checking is performed on file name which > contains bounds and resolution of the map. > > Do you think that it can be managed directly (and in a better way) in > Basemap(), let's say using the cache keyword set to False by default? > A cache directory in ~/.matplotlib/basemap can be used for that. > > > Stephane: I think this is best left in a separate module, since most people would not want the overhead incurred. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
|
From: Jeff W. <js...@fa...> - 2008-03-06 16:11:22
|
Tommy Grav wrote: > Is there a way of using imshow together with a basemap? > > Cheers > Tommy > Tommy: Use the imshow basemap method, just as you would the pylab version. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
|
From: Tommy G. <tg...@ma...> - 2008-03-06 16:03:03
|
Is there a way of using imshow together with a basemap? Cheers Tommy |
|
From: Stephane R. <ste...@gm...> - 2008-03-06 15:42:19
|
Hi,
this scalebar is a really good idea!
However, I suggest that all parameters must be optional:
- The position could be by default somewhere in the lower left corner
(for example). It may be interesting to find a "best" position using
the algo of legend.
- Then length could be estimated from automatically from the map coordinates.
On Tue, Mar 4, 2008 at 3:47 PM, Michael Hearne <mh...@us...> wrote:
> Jeff - I think the way GMT does it would be okay - they have a latitude of
> true scale, which I usually choose as the center latitude of the map.
>
> I was thinking we should allow people to choose the "simple" or "fancy"
> options. Do you think it will be okay to have the height of the bar and the
> text offset be relative to the length of it? I suppose if the height
> becomes a problem, people could use the yoffset keyword...
>
> --Mike
>
>
> On Mar 4, 2008, at 6:05 AM, Jeff Whitaker wrote:
>
> Michael Hearne wrote:
> Jeff - That would replicate the "simple" scale-bar from GMT. Below is my
> not-complete attempt at replicating the "fancy" scale bar. It would need
> some options for specifying different units (miles, nautical miles, etc.)
> and perhaps some more attention to spacing of the text from the scale bar
> and tick marks...
>
> --Mike
>
> Mike: Very nice! Do you want the scale to show the true distance on the
> earth (in which case the labels will vary depending on where the label is
> placed), or the distance in map projection coordinates (in which case the
> labels are constant)? Or perhaps a lat/lon value could be given to specify
> where the scale is true?
>
> -Jeff
>
> from numpy import *
> from matplotlib.toolkits.basemap import Basemap, pyproj
> from pylab import *
> # add drawscale method to Basemap class.
> class Basemap2(Basemap):
> def drawscale(self,lon,lat,length,yoffset=None):
> """draw a fancy map scale from lon-length/2,lat-yoffset to
> lon-length/2,lat-yoffset, label it with actual distance in km"""
> length = length*1000 #input length is km
>
> #we need 5 sets of x coordinates (in map units)
> #center of scale
> xc,yc = self(lon,lat)
> #left edge of scale
> lon1,lat1 = self(xc-length/2,yc,inverse=True)
> x1,y1 = self(lon1,lat1)
> #quarter scale
> lon2,lat2 = self(xc-length/4,yc,inverse=True)
> x2,y2 = self(lon2,lat2)
> #three quarter scale
> lon3,lat3 = self(xc+length/4,yc,inverse=True)
> x3,y3 = self(lon3,lat3)
> #right edge of scale
> lon4,lat4 = self(xc+length/2,yc,inverse=True)
> x4,y4 = self(lon4,lat4)
> if yoffset is None: yoffset = 0.1*length
>
> #plot top line
> ytop = yc+yoffset/2
> ybottom = yc-yoffset/2
> ytick = ybottom - yoffset/2
> ytext = ytick - yoffset/2
> m.plot([x1,x4],[ytop,ytop],color='k')
> #plot bottom line
> m.plot([x1,x4],[ybottom,ybottom],color='k')
> #plot left edge
> m.plot([x1,x1],[ybottom,ytop],color='k')
> #plot right edge
> m.plot([x4,x4],[ybottom,ytop],color='k')
>
> #make a filled black box from left edge to 1/4 way across
> fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],'k')
> #make a filled white box from 1/4 way across to 1/2 way across
> fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],'w')
> #make a filled white box from 1/2 way across to 3/4 way across
> fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],'k')
> #make a filled white box from 3/4 way across to end
> fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],'w')
> #plot 3 tick marks at left edge, center, and right edge
> m.plot([x1,x1],[ytick,ybottom],color='k')
> m.plot([xc,xc],[ytick,ybottom],color='k')
> m.plot([x4,x4],[ytick,ybottom],color='k')
>
> #label 3 tick marks
> text(x1,ytext,'%d' % (0),\
> horizontalalignment='center',\
> verticalalignment='top',\
> fontsize=9)
> text(xc,ytext,'%d' % (round((length/2)/1000)),\
> horizontalalignment='center',\
> verticalalignment='top',\
> fontsize=9)
> text(x4,ytext,'%d' % (round((length)/1000)),\
> horizontalalignment='center',\
> verticalalignment='top',\
> fontsize=9)
>
> #put units on top
> text(xc,ytop+yoffset/2,'km',\
> horizontalalignment='center',\
> verticalalignment='bottom',\
> fontsize=9)
>
> # setup of basemap ('lcc' = lambert conformal conic).
> # use major and minor sphere radii from WGS84 ellipsoid.
> m =
> Basemap2(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
> rsphere=(6378137.00,6356752.3142),\
> resolution='l',area_thresh=1000.,projection='lcc',\
> lat_1=50.,lon_0=-107.)
> # draw coastlines and political boundaries.
> m.drawcoastlines()
> m.fillcontinents()
> # draw parallels and meridians.
> # label on left, right and bottom of map.
> m.drawparallels(arange(0.,80,20.),labels=[1,1,0,1])
> m.drawmeridians(arange(10.,360.,30.),labels=[1,1,0,1])
> # draw a line from x1,y to x2,y and label it with distance in km.
> length = 3000 #kilometers
> x1,y1 = 0.25*m.xmax, 0.25*m.ymax
> lon1,lat1 = m(x1,y1,inverse=True)
> m.drawscale(lon1,lat1,length)
> title('a fancy map scale')
> show()
>
>
>
>
> ------------------------------------------------------
> Michael Hearne
> mh...@us... <mailto:mh...@us...>
> (303) 273-8620
> USGS National Earthquake Information Center
> 1711 Illinois St. Golden CO 80401
> Senior Software Engineer
> Synergetics, Inc.
> ------------------------------------------------------
>
>
>
>
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
> 325 Broadway Boulder, CO, USA 80305-3328
>
>
>
>
>
> ------------------------------------------------------
> Michael Hearne
> mh...@us...
> (303) 273-8620
> USGS National Earthquake Information Center
> 1711 Illinois St. Golden CO 80401
> Senior Software Engineer
> Synergetics, Inc.
> ------------------------------------------------------
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Stephane Raynaud
|
|
From: Stephane R. <ste...@gm...> - 2008-03-06 15:27:28
|
Hi Jeff: how about introducing a cache system for Basemap objects? You recently gave me the idea of using cPickle on Basemap objects, so I implement a very simple cache system that try to check if map has already been serialized and dumped to a cache file, before trying to create it from scratch. Checking is performed on file name which contains bounds and resolution of the map. Do you think that it can be managed directly (and in a better way) in Basemap(), let's say using the cache keyword set to False by default? A cache directory in ~/.matplotlib/basemap can be used for that. -- Stephane Raynaud |
|
From: <Jou...@xt...> - 2008-03-06 10:01:13
|
"Anthony Floyd" <ant...@gm...> writes: > I would like to 'watermark' a plot. That is, display an image 'under' > several lines. [...] I've tried using figure.figimage, but that only > draws the watermark 'outside' the plot area. Fair enough. The background of the axes object is called a "frame", and you want to not draw it at all (pass frameon=False to add_axes) or make it translucent: fig=figure(...) fig.figimage(...) ax=fig.add_subplot(...) ax.get_frame().set_alpha(0.5) -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: Anthony F. <ant...@gm...> - 2008-03-06 01:57:18
|
I'm stumped. I would like to 'watermark' a plot. That is, display an image 'under' several lines. I would like this watermark to be static and not change location, shape, or size while allowing for the lines to be zoomed and panned. I'm doing this all using the API (not pylab). I've tried using figure.figimage, but that only draws the watermark 'outside' the plot area. Fair enough. I've tried creating an axes object on top of my existing axes (actually my 'existing axes' is already four axes objects stacked on top of each other with some sharex magic happening) and using axes.imshow on that. While I do get the image, it doesn't display or behave as expected. Essentially the image displays in front of my first axes object, and no amount of twiddling with axes.set_zorder was affecting it. Things plotted on the subsequent axes plot on top of the image. This reflects the axes creation sequence, but zorder doesn't seem to be doing anything. I've also explicitly set the zorder of the image, but didn't see any effect there either. Adding to my confusion, the 'watermark' axes' size is wrong. When I create the axes object, I set the size using rect=axes1.get_position() in the figure.add_axes() call. The other 'real' axes use the same thing, but manage to get the size correct. The watermark axes is essentially the size of my image. Does anyone know what I've missed? I've hit the wiki, I've exercised my Google-fu, but I don't see any examples of what I'm trying to do. I'm using mpl 0.90.0 at the moment ... but if pressed we can upgrade to a newer release (our reason for not keeping up with releases is the old 'not broken, don't fix'). At the moment I'm not too worried about keeping the axes static while panning and zooming ... I've already customized backend_bases and I can skip the watermark axes when the zoom and pan events are processed. But it sure would be nice to be able to display this image (and later, some static text boxes that don't move with the plots too) in the appropriate location. Thanks for any suggestions, Anthony. |
|
From: Ryan M. <rm...@ou...> - 2008-03-05 21:35:21
|
Ryan May wrote: > Hi, > > I'm trying to get matplotlib to replot a pcolor image as data in a file > is updated. What's the proper way to do this? The best approach I > could come up with is as follows: Ok, I hadn't noticed the dynamic_image_gtkagg.py example before. I'm pretty sure this will do what I need. Anyone have any pitfalls or gotcha's with this method? Thanks, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |