Re: [Matplotlib-users] quick numpy question
Thank you, and I apologize if the question wasnt appropriate for this list. P.Romero > To: matplotlib-users@lists.sourceforge.net > From: j...@iki.fi > Date: Wed, 18 Mar 2009 07:44:33 +0200 > Subject: Re: [Matplotlib-users] quick numpy question > > Pablo Romero writes: > >> quick numpy-related question. > > Not the best mailing list then, but... > >> I want to use numpy.arange() to create multiple arrays, and then I >> want to join these arrays (or individual elements) to the final array >> without repeating existing elements (create a 'union' from 2 or more >> arrays or individual elements). > > Try np.union1d (and note that the numpy book has been in the public > domain since August: http://www.tramy.us/guidetoscipy.html ) > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > > > -- > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users _ Hotmail® is up to 70% faster. Now good news travels really fast. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009 -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] More funky font baselines
Mike, I've found another case of the funk baseline: import matplotlib.pyplot as plt plt.title('$Z_{DR}$ (from ts)') plt.show() I've attached an image of what I see. Here's my matplotlibrc: backend : GtkAgg mathtext.fontset : stixsans mathtext.default : regular font.size : 10.0 savefig.dpi : 100 Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Sent from: Norman Oklahoma United States. <>-- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] draw to memory
Hi all, i need to draw a polygon (non-convex) into memory, so that i can query which pixels are inside the polygon and which not. I came across matplotlib which has some Polygon class in it so i presume i could use this (although so far, i didn't understand the terminology behind the library and how to string things together... patches? artists? O_O) What is the easiest way to draw the filled polygon, defined by a sequence of points, into some 1bit raster, so that i can answer queries like "Is the pixel at [10, 12] inside the polygon?" Cheers! -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draw to memory
On Wed, Mar 18, 2009 at 2:48 PM, crwe crwe wrote: > Hi all, > > i need to draw a polygon (non-convex) into memory, so that i can query which > pixels are inside the polygon and which not. I came across matplotlib which > has some Polygon class in it so i presume i could use this (although so far, > i didn't understand the terminology behind the library and how to string > things together... patches? artists? O_O) > > What is the easiest way to draw the filled polygon, defined by a sequence of > points, into some 1bit raster, so that i can answer queries like "Is the > pixel at [10, 12] inside the polygon?" > > Cheers! > > -- > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > hi, did you find this? http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=codex%20nxutils#test-whether-a-point-is-inside-a-polygon -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draw to memory
> hi, did you find this? > http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=codex%20nxutils#test-whether-a-point-is-inside-a-polygon I used the search function but no, i didn't find that link :) Shame on me and thank you Brent. Looking at the implementation, it's really simple and i will do without matplotlib altogether and roll my own. In case anyone else needs this, the code is: def insidePoly(x, y, xs, ys): """Decide whether point (x, y) lies inside the 2d polygon defined by its vertices zip(xs, ys). """ result = False for now in xrange(len(xs)): if (ys[now] < y and ys[now - 1] >= y) or (ys[now - 1] < y and ys[now] >= y): if xs[now] + 1.0 * (y - ys[now]) * (xs[now - 1] - xs[now]) / (ys[now - 1] - ys[now]) < x: result = not result return result -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draw to memory
crwe crwe wrote: > Looking at the implementation, it's really simple and i will do > without matplotlib altogether and roll my own. It sounds like you have a solution, but if you need to test a LOT of points, it can be efficient to rasterize, and then get a lightning fast check. It that case, though, I'd be inclined to use something like PIL's ImageDraw, rather than MPL -- all of MPL's scaling, anti-aliasing, etc. will just make it harder. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to turn off all clipping?
Matplotlib Folks, How do I turn off all clipping when making a plot? It seems like everything has a set_clip_on argument, but I couldn't figure out how to set all of these to False without explicitly doing so in every plot call. I would assume that there is a way to do this using an rcParam or the matplotlibrc file? Any help would be appreciated! Thanks, Sara --- Sara Jean Hatch Inner Planet Mission Analysis Group Guidance, Navigation, & Control Section NASA - Jet Propulsion Laboratory 4800 Oak Grove Drive M/S: 301-150 Pasadena, CA 91109 Phone: (818) 354-8723 --- -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Using the same color range for multiple plots
Hi guys, I've tried to google this and look through the examples but its not quite working for me. Say I have two sets of data I want to make contour plots out of from pylab import * x=arange(-3.0,3.0,.025) y=arange(-2.0,2.0,.025) X,Y = meshgrid(x,y) Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) Now if I would go plt1 = subplot(211) contourf(X,Y,Z1) colorbar() plt2 = subplot(212) contourf(X,Y,Z2) colorbar() we would see that the same colors correspond to different numerical values, because the ranges of Z1 and Z2 are different. I want it to be defined on the same range, so that red on plt1 corresponds to the same numerical Z value as red on plt2. How do I go about doing that? -- View this message in context: http://www.nabble.com/Using-the-same-color-range-for-multiple-plots-tp22592487p22592487.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using the same color range for multiple plots
cneff wrote: > Hi guys, > > I've tried to google this and look through the examples but its not quite > working for me. Say I have two sets of data I want to make contour plots out > of > > from pylab import * > > x=arange(-3.0,3.0,.025) > > y=arange(-2.0,2.0,.025) > > X,Y = meshgrid(x,y) > > Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > > Now if I would go > > plt1 = subplot(211) > contourf(X,Y,Z1) > colorbar() > > plt2 = subplot(212) > contourf(X,Y,Z2) > colorbar() > > we would see that the same colors correspond to different numerical values, > because the ranges of Z1 and Z2 are different. I want it to be defined on > the same range, so that red on plt1 corresponds to the same numerical Z > value as red on plt2. How do I go about doing that? Instead of relying on autoscaling to set the color levels, set them explicitly to the same set of values in both calls to contourf by adding a fourth argument. e.g. levs = arange(0,1.01,0.1) ... contourf(X, Y, Z1, levs) ... contourf(X, Y, Z2, levs) ... Eric -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users