[Matplotlib-users] Multiple tick labels
Hello all, I feel like this is possible but I am having trouble figuring it out. I want to put extra labels on the ticks on the xaxis like in the upper panel of the figure http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif Following http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html doesn't seem to be the right thing. It seems that I can get the tick values from ax= gca() ax.get_xticks() and from here do the calculations on what the other labels should be (interpolate the spacecraft position). but then how do a create another row of labels with the values that compute? For some reason ax.get_xmajorticklabels()[0].get_text() returns '' Thanks much, Brian -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Line changes color along its length
Perfect thank you, no wonder I didnt find it, plt.gca().add_collection(lc) never found its way to my radar. Cheers, Brian On Sep 7, 2010, at 7:58 PM, Ryan May wrote: On Tue, Sep 7, 2010 at 6:50 PM, Brian Larsen balar...@lanl.gov wrote: Hey all, I think I know the answer here as no or something, but say I have a curve I want to plot and I want the color to change along the curve to denote the 3rd variable is there anyway to do this is matplotlib? What I mean is take the simple plot from pylab import * plot(range(30), range(30, 60), lw=10) and say that the 3rd variable is inten = [val ** 2 for val in range(30)] then can the line change color along its length according to a specified color table? In IDL this is done by just giving a color array with the same length as the data then the line changes with the current colortable. Try this: http://matplotlib.sourceforge.net/examples/pylab_examples/multicolored_line.html Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Line changes color along its length
Hey all, I think I know the answer here as no or something, but say I have a curve I want to plot and I want the color to change along the curve to denote the 3rd variable is there anyway to do this is matplotlib? What I mean is take the simple plot from pylab import * plot(range(30), range(30, 60), lw=10) and say that the 3rd variable is inten = [val ** 2 for val in range(30)] then can the line change color along its length according to a specified color table? In IDL this is done by just giving a color array with the same length as the data then the line changes with the current colortable. Thanks much, Brian -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Map displayed on a plot
Hello all, I am plotting satellite orbit files and it looks really nice to plot an Earth in the center with the continents on it to orient people to where the spacecraft is. Does anyway know how to do this? All I seem to be able to do is create a whole globe as the figure. In this simple example: from pylab import * r = ndarray(40) r[:] = 3.3 rad = linspace(0, 2*pi, 40) figure() subplot(111, polar=True) plot(rad, r, lw=3) draw() wouldn't it look great to have the earth plotted in the space up to 1.0 (as measured in earth radii)? Thanks much, Brian -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Map displayed on a plot
Ben, I have but no where in there do I see (or at least understand) how to draw a map on top of a current figure with set bounds in data space... Cheers, Brian On Aug 27, 2010, at 11:24 AM, Benjamin Root wrote: On Fri, Aug 27, 2010 at 12:11 PM, Brian Larsen balar...@lanl.gov wrote: Hello all, I am plotting satellite orbit files and it looks really nice to plot an Earth in the center with the continents on it to orient people to where the spacecraft is. Does anyway know how to do this? All I seem to be able to do is create a whole globe as the figure. In this simple example: from pylab import * r = ndarray(40) r[:] = 3.3 rad = linspace(0, 2*pi, 40) figure() subplot(111, polar=True) plot(rad, r, lw=3) draw() wouldn't it look great to have the earth plotted in the space up to 1.0 (as measured in earth radii)? Thanks much, Brian Have you checked out the basemap tool? http://matplotlib.sourceforge.net/basemap/doc/html/ Ben Root -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Map displayed on a plot
Thanks, that a step, but how do I tell matplotlib where to then put this map? It needs to be on the current figure with the current axes but between 0 and 1 in radius. Imagine this plot but the black circle instead contains a map of the earth as seen from space in the right viewing geometry. http://plasmasphere.nasa.gov/models/gcpm_v22_eq_kp1.jpg I can work out the geometry and all but putting the map in that black region has me baffled. Brian On Aug 27, 2010, at 11:52 AM, Aman Thakral wrote: Here is an example of the general usage for an orthographic projection. def genMap(fig, ax, llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat): fig.sca(ax) m = Basemap(resolution='i',projection='ortho',lon_0=(urcrnrlon+llcrnrlon)/2,lat_0=(urcrnrlat+llcrnrlat)/2) m.drawcoastlines() m.drawmapboundary(fill_color='aqua') m.drawstates(linewidth=3) m.fillcontinents(color='coral',lake_color='aqua') m.drawcountries(linewidth=3) where: llcrnlon = lower left corner longitude llcrnlat = lower left corner latitude urcrnlon =upper right corner longitude urcrnlat = upper right corner latitude On Fri, Aug 27, 2010 at 1:39 PM, Brian Larsen balar...@lanl.gov wrote: Ben, I have but no where in there do I see (or at least understand) how to draw a map on top of a current figure with set bounds in data space... Cheers, Brian On Aug 27, 2010, at 11:24 AM, Benjamin Root wrote: On Fri, Aug 27, 2010 at 12:11 PM, Brian Larsen balar...@lanl.gov wrote: Hello all, I am plotting satellite orbit files and it looks really nice to plot an Earth in the center with the continents on it to orient people to where the spacecraft is. Does anyway know how to do this? All I seem to be able to do is create a whole globe as the figure. In this simple example: from pylab import * r = ndarray(40) r[:] = 3.3 rad = linspace(0, 2*pi, 40) figure() subplot(111, polar=True) plot(rad, r, lw=3) draw() wouldn't it look great to have the earth plotted in the space up to 1.0 (as measured in earth radii)? Thanks much, Brian Have you checked out the basemap tool? http://matplotlib.sourceforge.net/basemap/doc/html/ Ben Root -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Aman Thakral B.Eng Biosci, M.Eng Design -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: balar...@lanl.gov Correspondence / Technical data or Software Publicly Available -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Font size on an axis
Hey all, wow, this seems like it should be an easy thing but I am not finding answers in the gallery or searching the documentation. How does one set the font size on ticklabels and labels for a figure? I would expect something like plot(arange(11), xfontsize=14) to work but I am not finding any keywords here for that. what am I missing? this works for the labels plot(arange(11)) ax=gca() ax.set_xlabel('i am x', size=18) I am trying all sorts of weird things for the ticklabels like plot(arange(11)) ax=gca() for val in ax.get_xticklabels(): ax.set_xticklabels(val._text, size=18) but this must be wrong. Thanks much, Brian -- --- Brian A Larsen, PhD RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 balar...@bu.edu -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Anyone going to Fall AGU next week
Hello all, I am new to matplotlib and loving it (No more IDL for me, woohoo). Are any experts attending the meeting that have done things in python/ matplotlib that I need to be sure and see? Still wrapping my mind around the python way instead of the IDL way and talking about cool science and visualizations done can be really useful. I'm in SM11A poster session Monday morning if anyone wants to stop by and say hello. SM11A-1562 Poster Hall (Moscone South) Cheers, Brian -- --- Brian A Larsen, PhD RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 balar...@bu.edu -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plotting a solid circle on a polar plot
Hello, this seems like it should be easy but I am beating my head on the wall here. I am trying to fill in everything rad=1 in a polar plot (this is a spacecraft orbit trace and the circle is the Earth) and can't seem to get it. from pylab import * from matplotlib.patches import Circle fig=figure() ax = fig.add_subplot(111, polar=True) ax.plot([2,2,2,2], [2,3,4,5]) el = Circle((0,0), radius=1,facecolor='black', axes=ax) ax.add_artist(el) draw() # also get the same result plotting with polar() and of course this dumbell looks nothing like the earth :) thanks much for any help, Brian -- --- Brian A Larsen, PhD RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 balar...@bu.edu -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] imagsc comparison
Hello all, several of my colleagues and I are 99% sure we are making the change from IDL to python-matplotlib. I have just one issue that I am trying to work out that I need to solve. We are so far really impressed and looking forward to the change. I have seen discussion on this list about imagesc and imshow but none of them have quite answered the questions. In IDL we spent way too much time writing an clone that is still not full featured: http://people.bu.edu/balarsen/IDLdoc/imagesc.html I have data of probability distributions which have an X and Y array associated with the axes of the 2-d distribution (image). What I don't see how to do in any easy fashion is plot this data in a imshow() manner with the axes correct (which are unevenly distributed and need to be plotted on a log axes). This can be done with contourf(X,Y,Z) but this has a few issues: - I dont see how to do a log axes on a contour - contour is the wrong plot as the inherent smoothing that a contour does is highly undesirable. Using matlab imagesc one can easily make plots similar to: http://img269.yfrog.com/i/2dprob.png/ Imagine taking the above plot and make the pixels different sizes so that each pixel has identical counting statistics. Now assume that one wanted the Y-axis to be plotted in log. Anyone have any thoughts or toy examples? Thanks much, Brian -- --- Brian A Larsen RBSP-ECT Instrument Suite Scientist Boston University Center for Space Physics 725 Commonwealth Ave, Rm 506 Boston, MA 02215-1401 T: 617-358-4945 F: 617-353-6463 balarsen --at -- bu.edu -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users