SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
(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)





Showing 20 results of 20

From: Zane S. <za...@id...> - 2008年03月14日 23:48:10
Attachments: zane.vcf
Hello all,
I need to do analysis of vector data (linear features, polylines) on the 
surface of a sphere. Many of the lines span a significant portion of 
the circumferance of the the body in question (Jupiter's moon Europa), 
and I want to be able to do the display of the data and analysis within 
Matplotlib.
Rather than writing my own (probably lame) module for manipulating and 
generating linear features stored as lists of (lat,lon) points, I'd 
prefer to build on someone else's work.
After a little searching around, it seems like most open GIS packages 
(e.g. OGL, GDAL) seem to work exclusively within a projected planar 
space. Am I missing something? Is there anyone else out there that 
does this kind of thing? What solutions do people have that work well 
with Matplotlib and the Basemap toolkit?
Ideally, I'd like to have the ability to perform transformations on the 
polylines, rotating and translating them on the surface of the sphere 
(without having to do the spherical trig myself), and I have to be able 
to have features cross the "date line" and wrap-around intelligently, 
calculate great-circle distances (and forward/back azimuths), best-fit 
great circles, etc.
Thanks for any recommendations you might have,
Zane
-- 
Zane Selvans
Amateur Human
za...@id...
303/815-6866
PGP Key: 55E0815F
From: Perry G. <pe...@st...> - 2008年03月14日 19:38:19
Note that numdisplay can display numpy arrays directly to ds9 without 
saving to a file. (http://stsdas.stsci.edu/numdisplay).
Perry
On Mar 14, 2008, at 12:44 PM, Chiara Caronna wrote:
> Hi,
> I tried ds9 and It looks like this is what I would like to do 
> (though I couldn't try funtools, but what you describe is good). DO 
> you think it is possible to make something like this with matplotlib?
> Thanks a lot for your help,
> Chiara
>
> > Date: 2008年3月12日 02:55:55 -0400
> > From: lee...@gm...
> > To: chi...@ho...
> > Subject: Re: [Matplotlib-users] Polygon masking possible?
> > CC: mat...@li...
> >
> > Hi,
> >
> > I often do this with ds9 and funtools.
> > ds9 is an astronomy-oriented image viewer (http://hea- 
> www.harvard.edu/RD/ds9/)
> > but you can also use it with numpy array.
> > Within ds9, you can define regions (ellipse, polynomial, etc) easily
> > with a mouse.
> > After you define a region (and save it as a file), you can 
> convert it
> > to a mask image
> > with funtools (funtools is a name of an astronomy-oriented image
> > utility pacakge).
> > funtools only support fits file (image format in astronomy) so this
> > can be a bit tricky, but if you're
> > interested i'll send my python wrapper code for it.
> >
> > So, take a look at ds9 and see it fits your need.
> > To view numpy array in ds9,
> > *. From python, save the array as a file (tofile method, better use
> > "arr" as an extension)
> > * in ds9, file-> open others -> open array. You need to select
> > array dimension, type and endianness of the array.
> >
> > Regards,
> >
> > -JJ
> >
> >
> >
> >
> >
> > On Sat, Mar 8, 2008 at 11:17 AM, Chiara Caronna
> > <chi...@ho...> wrote:
> > >
> > > 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: 2008年1月23日 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! MSN Messenger
> > > 
> ---------------------------------------------------------------------- 
> ---
> > > 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! MSN Messenger
> ---------------------------------------------------------------------- 
> ---
> 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
From: Bob C. <she...@ho...> - 2008年03月14日 19:16:56
Hello,
 
I have a problem when I try to refresh a plot I create.
 
The code is shown below:
 
What I want to do is that when the user initiates a key press the plot is updated. (If you minimise and maximise then it is done, the problem is the repainting of the window. I have tried searching on the web but cant find out how to do it (as well as trying lots of things with show() but alas no luck so far).
 
Any help much appreciated.
 
Thanks
 
 
 
import wximport osimport matplotlib
# either WX or WXAgg can be used here.# matplotlib.use('WX')# from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigCanvas
matplotlib.use('WXAgg')from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from matplotlib.figure import Figureimport matplotlib.numerix as numpy
class PlotFrame(wx.Frame):
 start_msg = """ Press Any Key to Initiate Plot - well thats the plan... """ def __init__(self): wx.Frame.__init__(self, None, -1, "Test Plotting") self.fig = Figure((5.0,3.0), 100) self.canvas= FigCanvas(self, -1, self.fig) self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75])
 sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) sizer.Add(wx.StaticText(self,-1, self.start_msg), 0, wx.ALIGN_LEFT|wx.TOP)
 self.canvas.Bind(wx.EVT_KEY_DOWN, self.onKeyEvent)
 self.SetSizer(sizer) self.Fit() self.Build_Menus()
 def Build_Menus(self): """ build menus """ MENU_EXIT = wx.NewId() MENU_SAVE = wx.NewId()
 menuBar = wx.MenuBar()
 f0 = wx.Menu() f0.Append(MENU_EXIT, "E&xit", "Exit") menuBar.Append(f0, "&File");
 self.SetMenuBar(menuBar)
 self.Bind(wx.EVT_MENU, self.onExit , id=MENU_EXIT) def onKeyEvent(self,event=None): """ capture , act upon keystroke events""" print "I plot here" self.Plot_Data() print "but how do i get it to be drawn?" self.Show()
 def onExit(self,event=None): self.Destroy()
 def Plot_Data(self): t = numpy.arange(0.0,5.0,0.01) s = numpy.sin(2.0*numpy.pi*t) c = numpy.cos(0.4*numpy.pi*t) self.axes.plot(t,s) self.axes.plot(t,c)
if __name__ == '__main__': app = wx.PySimpleApp() fig = PlotFrame() fig.Show(True) app.MainLoop()
 
 
 
_________________________________________________________________
Free games, great prizes - get gaming at Gamesbox. 
http://www.searchgamesbox.com 
From: José Gómez-D. <jgo...@gm...> - 2008年03月14日 18:03:24
On Friday 14 March 2008 16:44:54 Chiara Caronna wrote:
> I tried ds9 and It looks like this is what I would like to do (though I
> couldn't try funtools, but what you describe is good). DO you think it is
> possible to make something like this with matplotlib? Thanks a lot for your
The initiating thread (from January) had some suggestions. In particular, some 
code that does this from Rob Hetland: 
<http://www.nabble.com/Re%3A-Cross-hair-and-polygon-drawing-tools.-p14919733.html>
Hope that helps,
Jose
From: Kenneth M. <xke...@gm...> - 2008年03月14日 17:47:15
All,
 I've seen the examples for embedding matplot lib in Tk and the 
Tk animation example. However I've not yet been successful with 
creating an example where i can both animate data and stay in control 
of Tk. (The animation in tk example seems to lock the mainloop.) Does 
anyone have any advice or a quick example of a Tk app with an animated 
graph that doesn't lock the user out of Tk control?
Regards,
Kenneth Miller
From: Eric F. <ef...@ha...> - 2008年03月14日 17:45:38
Chris,
Use masked arrays. See masked_demo.py in the mpl examples subdirectory.
Eric
Chris Withers wrote:
> Hi All,
> 
> Say I have data that looks like:
> 
> date x y z
> 2008年01月01日 10
> 2008年01月02日 21 11
> 2008年01月02日 32 15 5
> 
> How can I plot it such that all three lines are plotted by that it's 
> apparent two of them are missing some data?
> (I know I could just sub in zeros for the missing values, but I'd like 
> the point not to be there, not just down the bottom of the graph...)
> 
> cheers,
> 
> Chris
> 
From: Christiaan P. <cep...@go...> - 2008年03月14日 17:24:55
:-) Hi there,
Just stick to the original plan. We know you've got some fixed measurement
points, it really doesn't matter how far apart or irregular they are. You
use these points to interpolate all the values in between for the specific
'time unit' you want to represent. Look at
http://www.scipy.org/Cookbook/Interpolation for an example of using
b-splines.
Interpolation will give you a pretty good 'guesstemate' of what the usage
would have been at that point had you gone and actually measured it.
Of course if you don't want to interpolate, you can simply normalize your
measurements to your time unit. Let's assume time unit of 1 day...
Between 2007年09月13日 and 2008年01月02日, 3000 units were used - 3000/111 days =
27.02 units per day
Between 2008年01月02日 and 2008年02月08日, 1000 units were used - 1000/37 days =
27.02 units per day
Between 2008年02月08日 and 2008年02月12日, 100 units were used - 100/4 days = 25
units per day
This obviously has the same disadvantage as linear interpolation in that
gradual changes over unmeasured periods will be shown as constant.
Hope we're getting closer to something you can use...
Have a nice day.
cputter
On 14/03/2008, Chris Withers <ch...@si...> wrote:
>
> (meant this to go to the list too)
>
>
> Christiaan Putter wrote:
> > I'm having trouble understanding what it is you exactly want.
>
>
> That's likely my fault ;-)
>
>
> > You said you want to indicate that 'the monthly usage between September
> 1st
> > and January 1st
> > was, on average, the same as that between January 1st and February 1st.'
>
>
> Yes, but "monthly" is a red herring here, the time periods are however
> long it's been since myself or the utility company checked the meter ;-)
>
>
> > The measurement your taking is not in fact the utility usage for one
> month,
> > but rather the sum of all usage over all prior months.
>
>
> Not really, and this was definitely me being unclear...
> We're talking about utility meters here, so you go and look at them and
> they show how many units of whatever it is (water, electicity, etc) they
> have delivered.
>
> So, that's how you get the time series (with more variation, to show
> reality, and avoid red herrings like "month"):
>
> 2007年09月13日 - 5000
> 2008年01月02日 - 8000
> 2008年02月08日 - 9000
> 2008年02月12日 - 9100
>
> So, the differences tell us:
>
> Between 2007年09月13日 and 2008年01月02日, 3000 units were used
> Between 2007年01月02日 and 2008年02月08日, 1000 units were used
> Between 2007年02月08日 and 2008年02月12日, 100 units were used
>
> So I guess it's this data that I'm looking to visualise in such a way
> that it's apprarent how much of the utility is being per unit time.
>
> NB: The measurements aren't regular, since they often come from when a
> person turns up and reads the meter, which isn't at all regular ;-)
>
> Does that make more sense? Any ideas?
>
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
> - http://www.simplistix.co.uk
>
>
> -------------------------------------------------------------------------
> 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
>
From: Chris W. <ch...@si...> - 2008年03月14日 17:13:23
Hi All,
Say I have data that looks like:
date x y z
2008年01月01日 10
2008年01月02日 21 11
2008年01月02日 32 15 5
How can I plot it such that all three lines are plotted by that it's 
apparent two of them are missing some data?
(I know I could just sub in zeros for the missing values, but I'd like 
the point not to be there, not just down the bottom of the graph...)
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chris W. <ch...@si...> - 2008年03月14日 17:00:31
(meant this to go to the list too)
Christiaan Putter wrote:
> I'm having trouble understanding what it is you exactly want.
That's likely my fault ;-)
> You said you want to indicate that 'the monthly usage between September 1st
> and January 1st
> was, on average, the same as that between January 1st and February 1st.'
Yes, but "monthly" is a red herring here, the time periods are however
long it's been since myself or the utility company checked the meter ;-)
> The measurement your taking is not in fact the utility usage for one month,
> but rather the sum of all usage over all prior months. 
Not really, and this was definitely me being unclear...
We're talking about utility meters here, so you go and look at them and
they show how many units of whatever it is (water, electicity, etc) they
have delivered.
So, that's how you get the time series (with more variation, to show
reality, and avoid red herrings like "month"):
2007年09月13日 - 5000
2008年01月02日 - 8000
2008年02月08日 - 9000
2008年02月12日 - 9100
So, the differences tell us:
Between 2007年09月13日 and 2008年01月02日, 3000 units were used
Between 2007年01月02日 and 2008年02月08日, 1000 units were used
Between 2007年02月08日 and 2008年02月12日, 100 units were used
So I guess it's this data that I'm looking to visualise in such a way
that it's apprarent how much of the utility is being per unit time.
NB: The measurements aren't regular, since they often come from when a
person turns up and reads the meter, which isn't at all regular ;-)
Does that make more sense? Any ideas?
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk
From: Chiara C. <chi...@ho...> - 2008年03月14日 16:45:05
Hi,
I tried ds9 and It looks like this is what I would like to do (though I couldn't try funtools, but what you describe is good). DO you think it is possible to make something like this with matplotlib?
Thanks a lot for your help,
Chiara
> Date: 2008年3月12日 02:55:55 -0400
> From: lee...@gm...
> To: chi...@ho...
> Subject: Re: [Matplotlib-users] Polygon masking possible?
> CC: mat...@li...
> 
> Hi,
> 
> I often do this with ds9 and funtools.
> ds9 is an astronomy-oriented image viewer (http://hea-www.harvard.edu/RD/ds9/)
> but you can also use it with numpy array.
> Within ds9, you can define regions (ellipse, polynomial, etc) easily
> with a mouse.
> After you define a region (and save it as a file), you can convert it
> to a mask image
> with funtools (funtools is a name of an astronomy-oriented image
> utility pacakge).
> funtools only support fits file (image format in astronomy) so this
> can be a bit tricky, but if you're
> interested i'll send my python wrapper code for it.
> 
> So, take a look at ds9 and see it fits your need.
> To view numpy array in ds9,
> *. From python, save the array as a file (tofile method, better use
> "arr" as an extension)
> * in ds9, file-> open others -> open array. You need to select
> array dimension, type and endianness of the array.
> 
> Regards,
> 
> -JJ
> 
> 
> 
> 
> 
> On Sat, Mar 8, 2008 at 11:17 AM, Chiara Caronna
> <chi...@ho...> wrote:
> >
> > 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: 2008年1月23日 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! MSN Messenger
> > -------------------------------------------------------------------------
> > 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: Bernhard V. <Ber...@de...> - 2008年03月14日 16:13:42
the set_visible method of the axis object should do the trick:
ax1.get_xaxis().set_visible(False)
same for ax2.
bernhard
On Thu, Mar 13, 2008 at 5:01 PM, Marcus Hauser <
M.H...@ls...> wrote:
> Dear all,
>
> is it possible to use a shared xaxis for several plots and switch off
> the xticklabels on all but the lowest plot?
>
> When I use ax.set_xticklabels([]) on one of the shared xaxis, the
> ticklabels on all xaxis vanishes...???
>
> Example:
> ax0 = pylab.axes( [0.1, 0.05, 0.88, 0.22] )
> plot...
> ax1 = pylab.axes( [0.1, 0.27, 0.88, 0.22], sharex = ax0)
> plot...
> ax2 = pylab.axes( [0.1, 0.49, 0.88, 0.22], sharex = ax0)
> ax2.set_xticklabels([])
> plot...
>
>
> The result is that neither ax0 nor ax1 have any xticklabes shown.
>
> I am using matplotlib 0.87 on Debian Etch.
>
>
> Regards,
> Marcus
>
> -------------------------------------------------------------------------
> 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
>
From: Michael B. <oht...@ma...> - 2008年03月14日 16:08:07
I'd like to make pcolor images using non-'cyl' projections, but I want 
the pcolor pixels to be trapezoidal rather than rectangular. Is this 
possible?
Mike
Example script"
# example data
lonin = numpy.arange(0.,360.,2.5)
latin = numpy.arange(-90.,92.5,2.5)
field = numpy.ones([len(latin),len(lonin)]) + 
10.0*numpy.random.random([len(latin),len(lonin)])
# adapt for plot
#field,lons = addcyclic(field,lonin)
#field,lons = shiftgrid(180.,field,lons,start=False)
# offset for pcolor
field = 0.5*(field[:-1,:-1]+field[1:,1:])
fig = figure()
canvas = FigureCanvas(fig)
the_map = Basemap(resolution='c',projection='lcc',llcrnrlon=-75.,
 llcrnrlat=15.,urcrnrlon=40.,urcrnrlat=60.,lat_1=50.,
 lon_0=-45.)
# convert to projected coordinates
dx = 2.*pi*the_map.rmajor/len(lons)
nx = int((the_map.xmax-the_map.xmin)/dx)+1
ny = int((the_map.ymax-the_map.ymin)/dx)+1
z,x,y = 
the_map.transform_scalar(field,lons,lats,nx,ny,returnxy=True,order=0)
# creates seemingly correct image in term of grid placement, but with 
rectangular pixels
the_image = the_map.pcolor(x,y,z,shading='flat')
From: Bernhard V. <Ber...@de...> - 2008年03月14日 16:06:45
what are the values of pdf and ps fonttype in your rc file?
try using this:
ps.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
pdf.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
this includes the missing symbols into the ps/pdf file, if you choose type
42 the complete font will be inserted in the resulting file.
in addition check the mathtext.fontset setting, try using stix or cm:
mathtext.fontset: cm
best wishes, bernhard
On Fri, Mar 14, 2008 at 2:15 PM, Mark Bakker <ma...@gm...> wrote:
> Hello -
>
> I am trying this again. I recently upgraded to 0.91.2, and export of
> mathtext to eps files seems broken (at least with the default matplotlibrc
> file).
>
> Figure looks great on the screen (interactive mode). Exporting to png
> still works fine.
>
> But writing to eps file, the greek symbols (I tried \theta and
> \lambda) don't show up at all, while the latin symbols (a,b,c,etc) look very
> ugly (different font than used to). Any suggestions? Anybody seenig the same
> behavior?
>
> Thanks, Mark
>
>
>
>
>
> -------------------------------------------------------------------------
> 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
>
>
From: Manuel M. <mm...@as...> - 2008年03月14日 14:43:04
Fred Mailhot wrote:
> Hi there,
> 
> I've got 4 time series that live in a 2-d space (imagine points at
> (1,1), (1,2),(2,1), and (2,2) that drift a little over time), and I'm
> using scatter() to show them. How can I plot so that each of the
> groups of points has the same colour?
> 
> I've checked the docs and examples and can't seem to find quite what
> I'm looking for. A sample script or indication of where to look in the
> docs would be appreciated.
> 
> Many thanks!
> Fred.
What you can do is something like this:
 x = arange(4) # just some test-data
 y = x**2
 c = ['#ff0000', '#cc3300', '#996600', '#66cc00'] # the color sequence
 pylab.scatter(x,y, color=c)
I think you get what you are looking for if you do this for each group 
separately.
Manuel
From: Mark B. <ma...@gm...> - 2008年03月14日 14:37:15
Not sure, but do you just mean:
Point-specific colors with scatter
scatter([0,1,1,0],[0,0,1,1],10,'y',edgecolor='y')
Gives yellow points with size 10 color yellow.
Mark
From: Anthony F. <ant...@gm...> - 2008年03月14日 13:44:38
On Thu, Mar 6, 2008 at 3:00 AM, <Jou...@xt...> wrote:
> "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)
For the archives, I found that the best way to do this was to set the
frame alphas to 0.0, and to draw the watermark directly in the canvas'
.draw() routine. This allows for smooth panning and resizing.
Otherwise, when trying to redraw the watermark in response to an
EVT_SIZE (I'm using wx), two problems would come up. 1) The redraw
routine would happen before the frame/panel/canvas/figure 'knew' what
its new size was, causing some weird 'jumping around' artefacts, and
2) There'd be some serious flicker because the plot would be drawn
then the watermark would be drawn.
A>
From: Mark B. <ma...@gm...> - 2008年03月14日 13:15:04
Hello -
I am trying this again. I recently upgraded to 0.91.2, and export of
mathtext to eps files seems broken (at least with the default matplotlibrc
file).
Figure looks great on the screen (interactive mode). Exporting to png still
works fine.
But writing to eps file, the greek symbols (I tried \theta and
\lambda) don't show up at all, while the latin symbols (a,b,c,etc) look very
ugly (different font than used to). Any suggestions? Anybody seenig the same
behavior?
Thanks, Mark
From: Matthias M. <Mat...@gm...> - 2008年03月14日 07:35:08
Hello Michael,
for me there seems to be no problem. I'm using maplotlib version 0.91.2 (you 
can get you version using:
>>> import matplotlib
>>> print matplotlib.__version__
I'm not sure if it is due to the version, but if it is possible you may want 
to update to 0.91.2.
best regards
Matthias
On Thursday 13 March 2008 17:15, Michael Hearne wrote:
> If you read the documentation for the fill() function, it says the
> following:
>
> "The same color strings that plot supports are supported by the fill
> format string."
>
> The plot() documentation says this:
>
> "In addition, you can specify colors in many weird and
> wonderful ways, including full names 'green', hex strings
> '#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
> intensities as a string '0.8'. Of these, the string
> specifications can be used in place of a fmt group, but the
> tuple forms can be used only as kwargs."
>
> Through experimentation, I determined this:
> plot(array([1,2,3,4]),array([1,2,3,4]),'r') => works
> plot(array([1,2,3,4]),array([1,2,3,4]),'#FF0000') => does NOT work
> plot(array([1,2,3,4]),array([1,2,3,4]),color='#FF0000') => works
> plot(array([1,2,3,4]),array([1,2,3,4]),color=(1,0,0)) => works
>
>
> My second example would seem to contradict the documentation.
>
> However, my real question has to do with fill - the only color
> strings that it seems to support are the ones that plot does -
> namely, defined colors like 'r', 'g','b', etc.
>
> Assuming I have an axes set up as follows:
> f=figure();
> ax = gca()
>
> None of the following seem to work:
> ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array
> ([0.75,0.75,0.25,0.25,0.75]),'#FF0000')
> ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array
> ([0.75,0.75,0.25,0.25,0.75]),color='#FF0000')
> ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array
> ([0.75,0.75,0.25,0.25,0.75]),color=(1,0,0))
>
> How can I specify an non-predefined color for the fill() function?
>
> I am using matplotlib version 0.90.1, I think. I don't know the best
> way to get my matplotlib version information.
>
>
>
>
>
> ------------------------------------------------------
> Michael Hearne
> mh...@us...
> (303) 273-8620
> USGS National Earthquake Information Center
> 1711 Illinois St. Golden CO 80401
> Senior Software Engineer
> Synergetics, Inc.
> ------------------------------------------------------
From: Fred M. <fre...@gm...> - 2008年03月14日 03:00:44
Hi there,
I've got 4 time series that live in a 2-d space (imagine points at
(1,1), (1,2),(2,1), and (2,2) that drift a little over time), and I'm
using scatter() to show them. How can I plot so that each of the
groups of points has the same colour?
I've checked the docs and examples and can't seem to find quite what
I'm looking for. A sample script or indication of where to look in the
docs would be appreciated.
Many thanks!
Fred.
-- 
Research is what I'm doing when I don't know what I'm doing.
 -- Wernher von Braun
From: Christiaan P. <cep...@go...> - 2008年03月14日 02:28:53
---------- Forwarded message ----------
From: Christiaan Putter <cep...@go...>
Date: 14 Mar 2008 03:22
Subject: Re: [Matplotlib-users] visualisation for utility usage sought
To: Chris Withers <ch...@si...>
Hi there,
I'm having trouble understanding what it is you exactly want.
You said you want to indicate that 'the monthly usage between September 1st
and January 1st
was, on average, the same as that between January 1st and February 1st.'
So looking at the data you provided I'll assume the following:
The measurement your taking is not in fact the utility usage for one month,
but rather the sum of all usage over all prior months. And unfortunately it
seems measurements aren't very regular (you working for the gov?). :-) no
problem.
Seeing that we're missing some data for the months in between measurements
we'll have to interpolate.
The simplest will be linear line segments between the known data points.
(There are also some nice interpolation modules in scipy if you're looking
for something "smoother", ie. polynomials or cubic splines or something)
Linear interpolation should look something like this.
2007年09月01日 - 5000
2007年10月01日 - 5750
2007年11月01日 - 6500
2007年12月01日 - 7250
2008年01月01日 - 8000
2008年02月01日 - 9000
Of course we're looking for the usage per month so we'll just calculate the
difference in the aggregates.
2007年09月01日 - 0
2007年10月01日 - 750
2007年11月01日 - 750
2007年12月01日 - 750
2008年01月01日 - 750
2008年02月01日 - 1000
Obviously we don't have data prior to October so Augusts' usage ends up as
zero. Now you can simply through that at matplotlib's plot() command and
Bob's you're uncle. Using bar graphs for the usage per month is
recommended, seeing that the measurements are so inconsistent to begin with
plotting with continuous lines will only add to a false sense of accuracy.
I'll recommend not using linear interpolation on this because the data will
clearly be skewed. In our case there would have been a gradual increase in
usage from September to January, and not the constant usage that linear
interpolation gave us.
Hope this helps. With matplotlib and scipy you're basically covered for all
your scientific plotting needs.
Have a nice day now.
cputter
On 12/03/2008, Chris Withers <ch...@si...> wrote:
>
> Hi All,
>
> I hope this isn't considered off topic here, but this has been bugging
> me for a while and I reckon you guys may be able to help. To boot, I'd
> like to use matplotlib to make it happen, so I figure this list is fair
> game ;-)
>
> So, I have a series of measurements at points in time, eg:
>
> 2007年09月01日 - 5000
> 2008年01月01日 - 8000
> 2008年02月01日 - 9000
>
> ...and I'm looking to create some type of visualisation that indicates
> usage over time.
>
> The import point is that the gaps between point measurements are not
> constant, so a straight bar chart won't be right.
>
> The points also won't necessarilly be as convenient as those above, but
> hopefully they'll work as an example: What I'd expect to see would
> indicate that the monthly usage between September 1st and January 1st
> was, on average, the same as that between January 1st and February 1st.
>
> I'm having trouble expressing myself clearly, but hopefully I'm making
> some kind of sense.
>
> Any ideas very greatfully recieved!
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
> - http://www.simplistix.co.uk
>
> -------------------------------------------------------------------------
> 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
>
1 message has been excluded from this view by a project administrator.

Showing 20 results of 20

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /