[Matplotlib-users] fmt_xdata / fmt_ydata on polar plot?
Is there any way to do this? The example here works in Cartesian coordinates: http://matplotlib.org/examples/pylab_examples/coords_report.html but if you change subplots() to subplots(subplot_kw={'polar':True}) Then the millions() function is never even called. Thanks, Alex -- Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical virtual servers, alerts via email sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bug in matplotlib 1.4.2
Dear all, when plotting scattered data with the , marker, the data points do not show up either on screen (Qt4Agg backend) or in saved bitmap images (tested with png); they do show up if the plot is exported as pdf. Example code (run in ipython --pylab for simplicity): import numpy as np a = np.random.standard_normal(500) b = np.random.standard_normal(500) plot(a,b,',') savefig(testplot.png) savefig(testplot.pdf) Expected result: Scatter plot of random data points, both on screen and in saved files. Actual result: Empty-looking plot both on screen and in png, but plot as expected in pdf. System info: Arch linux, Kernel 3.17.6 (and 3.18.6), matplotlib version 1.4.2, Python 3.4.2, IPython 2.3.1., numpy version 1.9.1, Qt4Agg backend. Related: I posted this to the arch-bugtracker ( https://bugs.archlinux.org/task/43392) and asked on stack overflow whether anyone else saw this ( http://stackoverflow.com/questions/28112916/python-matplotlib-does-not-display-data-points-bug-or-something-else). Apparently, the same thing happens in Ubuntu, too. Hope this is the right place to report this. Cheers, Alex P.S.: I sent the same mail to the list a few weeks ago without registering, but it was never posted, nor replied to. It might be a good idea not to suggest at http://matplotlib.org/faq/troubleshooting_faq.html#getting-help that just sending a mail to the list will achieve anything... -- Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] One colorbar for many plot
I would consider using the AxesGrid toolkit [1], which makes it very easy to have a single colorbar for multiple plots. [1] - http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html Thanks, Alex On Tue, May 20, 2014 at 8:04 PM, Alex Goodman alex.good...@colostate.eduwrote: I would consider using the AxesGrid toolkit [1], which makes it very easy to have a single colorbar for multiple plots. [1] - http://matplotlib.org/1.3.1/mpl_toolkits/axes_grid/users/overview.html Thanks, Alex On Tue, May 20, 2014 at 7:57 PM, Dyah rahayu martiningrum dyahr...@gmail.com wrote: I am a newbie in python and I try to plot data like below : base_dir = 'C:/DATA2013/Day_E/' nc_fnames = ['20130203.faieb3p4g.nc', '20130203.faieb3p4g.nc','20130203.faieb3p4g.nc'] # beams ibeams = [0,1,2] # Change directory os.chdir(base_dir) for i, fname in enumerate(nc_fnames): # Open file fd = nc.Dataset(fname, 'r') # Read variables beam = fd.variables['beam'][:] rng = fd.variables['range'][:] tim = fd.variables['time'][:] pwr = fd.variables['pwr'][:] nfft = fd.variables['nfft'][0] pn = fd.variables['pnoise'][:] # Close netCDF file fd.close() # Specify beam ibeam = ibeams[i] # Time convertion tim = tim/3600.0 #Plot p_plot = pwr[ibeam] for it in range(len(tim)): p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft) p_plot = p_plot.transpose() #Specify subplot pl.subplot(311 + i)#Contour plot pl.contourf(tim, rng, p_plot)#Plot colorbar pl.colorbar() # Set X and Y axis lower/upper limit set_xy = range(4) set_xy[0] = 18.0 # x min set_xy[1] = 30.0 # x max set_xy[2] = 90.0 # y min set_xy[3] = 170.0 # y max pl.axis(set_xy) # Set labels pl.xlabel('time (hours)') pl.ylabel('range (km)') pl.show() The result looks like three panels with different colorbar for each panel. How do I make only one colorbar for all panels? Thank you in advance. -- Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free. http://p.sf.net/sfu/SauceLabs ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free. http://p.sf.net/sfu/SauceLabs___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can't plot NCEP reanalysis data
Hi Fadzil, I am not sure if I fully understand your question. Are you simply trying to write a general script that plots contours for atmospheric netcdf data? At the very least, your error message has a very simple explanation in that the third argument of contourf (in this case, pcpr or omg?) must be a 2D array with shape (Xsize, Ysize). For data with one vertical level, it would be reasonable to expect the script to work, but if you have multiple vertical levels and don't select a specific one in your code, then you can't use contourf, simple as that. Does that help at all? Alex On Tue, Mar 4, 2014 at 8:22 PM, Fadzil Mnor fadzilmno...@gmail.com wrote: Hi all, I've been looking for solution on this for days, and seems like nothing works. I wrote this code to read TRMM data and it works, but somehow not working when I use the same script to read NCEP reanalysis data...which later I found out it worked for netCDF files with only 1 'level' (Zsize=1), not multiple 'levels' (Zsize more than 1). I'm stuck at where went wrong, and I tried everything and lost of track what the error massages were. This is what I wrote to read and plot NCEP reanalysis data. (this omega data has Xsize=144, Ysize=73, Zsize=12, Tsize=792, Esize=1) --- *import netCDF4 as nc* *import matplotlib.pyplot as plt* *from mpl_toolkits.basemap import Basemap* *import numpy as np* *f = nc.Dataset('D:/data/omega.mon.mean.nc http://omega.mon.mean.nc','r')* *omg = f.variables['omega'][0]* *lon = f.variables['lon'][:]* *lat = f.variables['lat'][:]* *times = f.variables['time'][:]* *# Set up a map * *map = Basemap(projection='cyl',llcrnrlat=0.,urcrnrlat=10.,llcrnrlon=97.,urcrnrlon=110.,resolution='i')* *x,y=map(*np.meshgrid(lon,lat))* *map.drawcoastlines()* *map.drawcountries()* *map.drawparallels(np.arange(-90.,90.,3),labels=[1,0,0,0],fontsize=10)* *map.drawmeridians(np.arange(-180.,180.,3),labels=[0,0,0,1],fontsize=10)* *#contour data* *clevs=np.arange(0.,1.,0.1) # contour interval* *cs = map.contourf(x,y,pcpr,clevs,extent='both')* *cb = map.colorbar(cs,'bottom',size='2%',pad=5%) #plot the colorbar * *cb.set_label('m/s')* *plt.title('Omega-test')* *plt.show()* *f.close()* - Above code gave error: Input z must be a 2D array (that's at *cs = map.contourf(x,y,pcpr,clevs,extent='both')*...) Hopefully anyone can help. Thanks for your time reading this. Fadzil -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Subversion Kills Productivity. Get off Subversion Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Area averaged
Hi Fadzil, All you actually need to do is use numpy.average(), which is numpy's implementation of the weighted average. It can be shown geometrically that using the cosine of the latitude as the weights in the weighted average would give you approximately the area average, though if your SST data has a grid cell area attribute in the netcdf file, that would be the most suitable choice to use as your weights. Otherwise, you could determine the area weighted average as follows: # numpy is imported as np, lat are the latitudes extracted from the netcdf file # First we need to convert the latitudes to radians latr = np.deg2rad(lat) # Use the cosine of the converted latitudes as weights for the average weights = np.cos(latr) # Assuming the shape of your data array is (nTimes, nLats, nLons) # First find the zonal mean SST by averaging along the latitude circles sst = sstv[:] sst_ave_zonal = sst.mean(axis=2) # Then take the weighted average of those using the weights we calculated earlier sst_ave = np.average(sst_ave_zonal, axis=1, weights=weights) This should give a time series of global mean SST. Is this what you wanted? Thanks, Alex On Sun, Feb 23, 2014 at 10:28 AM, Fadzil Mnor fadzilmno...@gmail.comwrote: Hi, I just started using Python for the last few weeks, and previously been using GrADS for around 4 years. I have trouble looking for a simplest way to calculate area average, let say I need to calculate a SST over a region of 20S-10N and 130E-170E. I know how to get one point values of SST vs Time, as in: ... ... f = nc.Dataset('d:/data/sst.mon.mean.nc', 'r') sstv = f.variables['sst'] timev = f.variables['time'] sst = sstv[:, 35, 100] plt.plot(timev,sst) plt.show() ... ... *** but I couldn't figure out how to get an area average value (...and didn't get the right reference in the internet either) Something missing, probably because I don't understand enough about slicing or something else. Can anyone give me a hint ? Thanks. Fadzil. -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Area averaged
Hi Fadzil, Ah sorry, I glossed over that part of your question. There are actually two solutions to this, one would be to actually find the indices where the latitudes and longitudes are within your desired bounds using numpy.where(). However I generally prefer to use numpy's built-in fancy indexing for this type of problem. For example: # lat and lon are extracted from the netcdf file, assumed to be 1D # Determine which latitudes are between 20S and 10N latidx = (lat = -20) (lat = 10) # Determine which longitudes are between 130E and 170E. # The numbers here may differ depending on the longitude convention in your data. lonidx = (lon = 130) (lon = 170) # Now we will actually subset the data. We need to subset lat too to make sure weights are consistent. sst = sstv[:] sst = sst[:, latidx][..., lonidx] lat = lat[latidx] Yes, the indexing does get a little tricky but it should work if you do it this way, then follow the same procedure outlined in the previous email. Thanks, Alex On Sun, Feb 23, 2014 at 6:02 PM, Fadzil Mnor fadzilmno...@gmail.com wrote: Thanks Alex for the reply. So, that script calculates the global SST. What if when we want to calculate for only in specific box? For example, SST over this area only: --- 10 N | | | | | | | SST | | | | | --- 20 S 130 E 170E Thanks. Fadzil -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Flow-based real-time traffic analytics software. Cisco certified tool. Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer Customize your own dashboards, set traffic alerts and generate reports. Network behavioral analysis security monitoring. All-in-one tool. http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [os x] Can't get IPython to use latest version of matplotlib
Hi Tim, Whenever you have two python versions installed to one machine, it is generally a good practice to set your PATH environment variable to the directory where the python executable you want to use currently lies, and make it permanent by adding it to your ~/.bash_profile file (on MacOSX). Say your python.org version of python was installed in /something/bin. Then add the following line to your ~/.bash_profile: export PATH=/something/bin:$PATH Then run these commands: source ~/.bash_profile which python which pip If the output is /something/bin, then you are good to go; pip should then install matplotlib in the correct place. Hope that helps. Thanks, Alex On Fri, Feb 21, 2014 at 4:58 PM, Timothy Duly timdu...@gmail.com wrote: Paul, Do you know how to to get pip install on python.org's version? Thanks, Tim On Fri, Feb 21, 2014 at 5:53 PM, Paul Hobson pmhob...@gmail.com wrote: It appears that you have two different version of python installed (Apple's 2.7.3 and python.org's 2.7.5). You have to install all third-party packages to the correct one. It appears pip in acting on Apple's python. On Fri, Feb 21, 2014 at 2:08 PM, Timothy Duly timdu...@gmail.com wrote: Hello, I recently upgraded matplotlib, which was relatively simple: sudo pip install matplotlib --upgrade I checked to make sure I did indeed upgrade: [~]$ python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. import matplotlib; matplotlib.__version__ '1.3.1' Success. However, when I do the same in IPython, I get the old version: [~]$ ipython --pylab Python 2.7.5 (default, Aug 25 2013, 00:04:04) Type copyright, credits or license for more information. IPython 1.2.0 -- An enhanced Interactive Python. ? - Introduction and overview of IPython's features. %quickref - Quick reference. help - Python's own help system. object? - Details about 'object', use 'object??' for extra details. Using matplotlib backend: MacOSX In [1]: import matplotlib; matplotlib.__version__ Out[1]: '1.1.1' Anyone know why this is the case? How do I point IPython to the newest version of matplotlib? I tried googling, but wasn't sure how to zero in on the answer with a search. Also, I'm not sure if this question is best suited for IPython people. Thanks, Tim -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- - Timothy M. Duly Graduate Research Assistant Remote Sensing Space Sciences Group Department of Electrical and Computer Engineering University of Illinois at Urbana-Champaign airglow.csl.illinois.edu - -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] could I get rid of the contour of Antarctica by using Basemap?
A quick apology for a typo in my previous message, the method in question is drawcoastlines(), not drawcontinents(). The code snippet should still be correct though! On Mon, Dec 30, 2013 at 7:09 PM, Alex Goodman alex.good...@colostate.eduwrote: Hi Chao, Actually it is possible to remove the borders for Antarctica with basemap. The default method for drawing the continents in basemap, drawcontinents(), returns an instance of matplotlib.collections.LineCollection. What you will want to do is manually remove the line segments within the collection that correspond to Antarctica. For example, # m is a Basemap instance lcol = m.drawcoastlines() segs = lcol.get_segments() for i, seg in enumerate(segs): # The segments are lists of ordered pairs in spherical (lon, lat), coordinates. # We can filter out which ones correspond to Antarctica based on latitude using numpy.any() if np.any(seg[:, 1] -60): segs.pop(i) lcol.set_segments(segs) This should do the trick unless I made a silly typo somewhere. Thanks, Alex On Mon, Dec 30, 2013 at 5:05 PM, Sterling Smith smit...@fusion.gat.comwrote: Chao, I know nothing of the Basemap toolkit so I can't comment on the removal of continents, but presumably the text command you are using takes some keywords to set the properties of the bounding box. Try setting the background of the bounding box to white so that your words show up cleanly. Feel free to let me know that I'm barking up the wrong tree. -Sterling On Dec 30, 2013, at 3:46PM, Chao YUE wrote: Dear all, Happy new year! I am using Basemap toolkit to make some maps, I would like to write something at the bottom of the map, whose position is now taken by the contourf of Antarctica. Is there a way I can keep contours of other continents but suppressing the one for antarctica? I attached showing why I would like to have this. thanks for any help, Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 figure_4_new.jpg-- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Clipping a plot inside a polygon
Hi Phil, Thanks, that is more or less what I was looking for. However, I still think that generalizing this approach for other types of plotting functions that don't return artists directly would be useful. Your solution gave me another idea for doing this, which would be to iterate through all of the child artists on the axes using the get_children() method and then calling set_clip_path() on each artist. This would make the methodology very general but I am not sure if there are any negative side effects to resetting the clip path on the other artists besides the PatchCollections. I modified my simple example script and it seems to work well for contourf(), pcolor(), and imshow(): import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) ax.contourf(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) for artist in ax.get_children(): artist.set_clip_path(poly) ax.add_patch(poly) ax.set_aspect('equal') ax.axis('off') plt.show() Also, I appreciated the cartopy example. I think it has the potential to be a good basemap replacement thanks to the more robust shapefile support (which you have very elegantly shown), and I hope the development goes well. Thanks, Alex On Mon, Sep 2, 2013 at 2:33 AM, Phil Elson pelson@gmail.com wrote: Great question. The contour set itself does not have a set_clip_path method but you can iterate over each of the contour collections and set their respective clip paths, i.e.: cs = plt.contourf(data) for collection in cs.collections: collection.set_clip_path(poly) Of course, you can use this approach in either Basemap or cartopy, but I've put together an example of doing it in cartopy to demonstrate the neat Shapely integration: http://nbviewer.ipython.org/6410510 HTH, Phil On 2 September 2013 05:40, Alex Goodman alex.good...@colostate.eduwrote: Hi all, I want to be able to plot data on maps (using basemap or cartopy) inside specific regions, eg a single state, province or country. A similar question was asked a long time ago on the mailing list and the suggested solution back then was to read the bounding polygon from a shapefile and then check if each individual point was inside that polygon. Currently I have no problem doing this if I use matplotlib.path.Path.contains_points() to mask the original data array, but the disadvantage to this solution is that it is very slow. Another solution that I have discovered recently is to use the set_clip_path() method for artists. In addition to being much faster, this also makes the areas near the polygon boundary look much smoother since the actual items being clipped are individual pixels and not data points. Here is an example script that plots an image via imshow, but the only part of the image that gets shown is inside the hexagon. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) im.set_clip_path(poly) ax.add_patch(poly) ax.axis('off') plt.show() While this does seem like an ideal solution, it doesn't work for every type of plot. The most notable example is contourf(). It returns a QuadContourSet instance which does not inherit from Artist, so it does not contain the set_clip_path() method. My main question is whether there is a mechanism in matplotlib that can convert something like a QuadContourSet into an image so I can make use of this solution for contourf() as well. Or better yet, is there perhaps another artist within the axes that I can use the set_clip_path() method for and still get what I want? Thanks, Alex -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft
Re: [Matplotlib-users] Clipping a plot inside a polygon
Actually, it seems I have partially answered my own question. Since I am calling axis('off'), I do not notice the effect of clipping the other artists since I made a call to axis('off'). Without it the spines and axes rectangle are still removed but the ticks are still visible. I suppose this is fine for my own purposes of contouring within one country on a map since I would want to use something like axis('off') anyway, but then it would not work if I wanted to use the axes background. Another approach I have tried is to use the clip_path keyword in the plotting functions themselves, which works for imshow and pcolor, but not contourf. Any other ideas? Alex On Mon, Sep 2, 2013 at 12:18 PM, Alex Goodman alex.good...@colostate.eduwrote: Hi Phil, Thanks, that is more or less what I was looking for. However, I still think that generalizing this approach for other types of plotting functions that don't return artists directly would be useful. Your solution gave me another idea for doing this, which would be to iterate through all of the child artists on the axes using the get_children() method and then calling set_clip_path() on each artist. This would make the methodology very general but I am not sure if there are any negative side effects to resetting the clip path on the other artists besides the PatchCollections. I modified my simple example script and it seems to work well for contourf(), pcolor(), and imshow(): import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) ax.contourf(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) for artist in ax.get_children(): artist.set_clip_path(poly) ax.add_patch(poly) ax.set_aspect('equal') ax.axis('off') plt.show() Also, I appreciated the cartopy example. I think it has the potential to be a good basemap replacement thanks to the more robust shapefile support (which you have very elegantly shown), and I hope the development goes well. Thanks, Alex On Mon, Sep 2, 2013 at 2:33 AM, Phil Elson pelson@gmail.com wrote: Great question. The contour set itself does not have a set_clip_path method but you can iterate over each of the contour collections and set their respective clip paths, i.e.: cs = plt.contourf(data) for collection in cs.collections: collection.set_clip_path(poly) Of course, you can use this approach in either Basemap or cartopy, but I've put together an example of doing it in cartopy to demonstrate the neat Shapely integration: http://nbviewer.ipython.org/6410510 HTH, Phil On 2 September 2013 05:40, Alex Goodman alex.good...@colostate.eduwrote: Hi all, I want to be able to plot data on maps (using basemap or cartopy) inside specific regions, eg a single state, province or country. A similar question was asked a long time ago on the mailing list and the suggested solution back then was to read the bounding polygon from a shapefile and then check if each individual point was inside that polygon. Currently I have no problem doing this if I use matplotlib.path.Path.contains_points() to mask the original data array, but the disadvantage to this solution is that it is very slow. Another solution that I have discovered recently is to use the set_clip_path() method for artists. In addition to being much faster, this also makes the areas near the polygon boundary look much smoother since the actual items being clipped are individual pixels and not data points. Here is an example script that plots an image via imshow, but the only part of the image that gets shown is inside the hexagon. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) im.set_clip_path(poly) ax.add_patch(poly) ax.axis('off') plt.show() While this does seem like an ideal solution, it doesn't work for every type of plot. The most notable example is contourf(). It returns a QuadContourSet instance which does not inherit from Artist, so it does not contain the set_clip_path() method. My main question is whether there is a mechanism in matplotlib that can convert something like a QuadContourSet into an image so I can make use of this solution for contourf() as well. Or better yet, is there perhaps another artist within the axes that I can use the set_clip_path() method for and still get what I want? Thanks, Alex -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University -- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover
Re: [Matplotlib-users] Clipping a plot inside a polygon
Actually, sorry for the triple post, but is there a reason why we can't do something like pass in the keyword arguments directly from the call to contourf when instantiating each collection? Then the keyword arguments for contourf (and ContourSet) could be used for the collections directly, including clip_path. I know a similar approach is taken for the keyword arguments in plot, since those can be used to modify the properties of each Line2D instance. Thanks, Alex On Mon, Sep 2, 2013 at 1:09 PM, Alex Goodman alex.good...@colostate.eduwrote: Actually, it seems I have partially answered my own question. Since I am calling axis('off'), I do not notice the effect of clipping the other artists since I made a call to axis('off'). Without it the spines and axes rectangle are still removed but the ticks are still visible. I suppose this is fine for my own purposes of contouring within one country on a map since I would want to use something like axis('off') anyway, but then it would not work if I wanted to use the axes background. Another approach I have tried is to use the clip_path keyword in the plotting functions themselves, which works for imshow and pcolor, but not contourf. Any other ideas? Alex On Mon, Sep 2, 2013 at 12:18 PM, Alex Goodman alex.good...@colostate.eduwrote: Hi Phil, Thanks, that is more or less what I was looking for. However, I still think that generalizing this approach for other types of plotting functions that don't return artists directly would be useful. Your solution gave me another idea for doing this, which would be to iterate through all of the child artists on the axes using the get_children() method and then calling set_clip_path() on each artist. This would make the methodology very general but I am not sure if there are any negative side effects to resetting the clip path on the other artists besides the PatchCollections. I modified my simple example script and it seems to work well for contourf(), pcolor(), and imshow(): import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) ax.contourf(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) for artist in ax.get_children(): artist.set_clip_path(poly) ax.add_patch(poly) ax.set_aspect('equal') ax.axis('off') plt.show() Also, I appreciated the cartopy example. I think it has the potential to be a good basemap replacement thanks to the more robust shapefile support (which you have very elegantly shown), and I hope the development goes well. Thanks, Alex On Mon, Sep 2, 2013 at 2:33 AM, Phil Elson pelson@gmail.com wrote: Great question. The contour set itself does not have a set_clip_path method but you can iterate over each of the contour collections and set their respective clip paths, i.e.: cs = plt.contourf(data) for collection in cs.collections: collection.set_clip_path(poly) Of course, you can use this approach in either Basemap or cartopy, but I've put together an example of doing it in cartopy to demonstrate the neat Shapely integration: http://nbviewer.ipython.org/6410510 HTH, Phil On 2 September 2013 05:40, Alex Goodman alex.good...@colostate.eduwrote: Hi all, I want to be able to plot data on maps (using basemap or cartopy) inside specific regions, eg a single state, province or country. A similar question was asked a long time ago on the mailing list and the suggested solution back then was to read the bounding polygon from a shapefile and then check if each individual point was inside that polygon. Currently I have no problem doing this if I use matplotlib.path.Path.contains_points() to mask the original data array, but the disadvantage to this solution is that it is very slow. Another solution that I have discovered recently is to use the set_clip_path() method for artists. In addition to being much faster, this also makes the areas near the polygon boundary look much smoother since the actual items being clipped are individual pixels and not data points. Here is an example script that plots an image via imshow, but the only part of the image that gets shown is inside the hexagon. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) im.set_clip_path(poly) ax.add_patch(poly) ax.axis('off') plt.show() While this does seem like an ideal solution, it doesn't work for every type of plot. The most notable example is contourf(). It returns a QuadContourSet instance which does not inherit from Artist, so it does not contain the set_clip_path() method. My main question is whether there is a mechanism
[Matplotlib-users] Clipping a plot inside a polygon
Hi all, I want to be able to plot data on maps (using basemap or cartopy) inside specific regions, eg a single state, province or country. A similar question was asked a long time ago on the mailing list and the suggested solution back then was to read the bounding polygon from a shapefile and then check if each individual point was inside that polygon. Currently I have no problem doing this if I use matplotlib.path.Path.contains_points() to mask the original data array, but the disadvantage to this solution is that it is very slow. Another solution that I have discovered recently is to use the set_clip_path() method for artists. In addition to being much faster, this also makes the areas near the polygon boundary look much smoother since the actual items being clipped are individual pixels and not data points. Here is an example script that plots an image via imshow, but the only part of the image that gets shown is inside the hexagon. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon data = np.arange(100).reshape(10, 10) fig = plt.figure() ax = fig.add_subplot(111) im = ax.imshow(data) poly = RegularPolygon([ 0.5, 0.5], 6, 0.4, fc='none', ec='k', transform=ax.transAxes) im.set_clip_path(poly) ax.add_patch(poly) ax.axis('off') plt.show() While this does seem like an ideal solution, it doesn't work for every type of plot. The most notable example is contourf(). It returns a QuadContourSet instance which does not inherit from Artist, so it does not contain the set_clip_path() method. My main question is whether there is a mechanism in matplotlib that can convert something like a QuadContourSet into an image so I can make use of this solution for contourf() as well. Or better yet, is there perhaps another artist within the axes that I can use the set_clip_path() method for and still get what I want? Thanks, Alex -- Alex Goodman Graduate Research Assistant Department of Atmospheric Science Colorado State University attachment: clip_example.png-- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplots [xy]labels
Hi Giacomo, Try using the set_ylabel() and set_xlabel() methods for each Axes instance instead, eg: a[0].set_ylabel('f1') a[0].set_xlabel('t') a[1].set_ylabel('f2') a[1].set_xlabel('t') On Fri, Jan 4, 2013 at 5:44 AM, giacomo.bo...@polimi.it wrote: two plots in a figure: from pylab import * ... f,a = subplots(nrows=2, sharex=False, sharey=False) a[0].plot(x,f0(x)) ylabel('f1') xlabel('t') ... a[1].plot(x,f1(x)) ylabel('f2') xlabel('t') ... show() but all i can get are labels for ONLY the lower subplot, what shoud I do? any help will be appreciated tia gb -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Alex Goodman University of Illinois at Urbana-Champaign Email: goodm...@illinois.edu -- Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ANN: pythonpackages.com beta
Hi matplotlib folks, I am reaching out to various Python-related programming communities in order to offer my help packaging your software. If you have ever struggled with packaging and releasing Python software (e.g. to PyPI), please check out my new service: - http://pythonpackages.com The basic idea is to automate packaging by checking out code, testing, and uploading (e.g. to PyPI) all through the web, as explained in this introduction: - http://docs.pythonpackages.com/en/latest/introduction.html Also, I will be available to answer your Python packaging questions most days/nights in #pythonpackages on irc.freenode.net. Hope to meet/talk with all of you soon. Alex -- Alex Clark · http://pythonpackages.com/ONE_CLICK -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot Fill with Jacobian Coordinates
On Thu, Dec 15, 2011 at 9:32 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Dec 15, 2011 at 3:18 PM, Alex Naysmith yeoman.pyt...@gmail.comwrote: On Tue, Dec 13, 2011 at 7:12 PM, Alex Naysmith yeoman.pyt...@gmail.comwrote: On Mon, Dec 12, 2011 at 7:03 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Dec 10, 2011 at 10:36 AM, Alex Naysmith yeoman.pyt...@gmail.com wrote: Hello, I'm trying to plot the stresses in colour of a strained isoparametric element. I have a six noded triangle with vertice coordinates [(xa1,ya1),(xa2,ya2),(xa3,ya3)] = pos_a This triangle deforms and the new coordinate positions are [(xb1,yb1),(xa2,yb2),(xb3,yb3)] = pos_b The remaining nodes are mid nodes also with rest and deformed coordinate positions. To plot the edges of the triangle I use a Jacobian transformation function so that the coordinates of the triangle are in Jacobian coordinates xi1 and xi2 (with xi3 = 1 - xi1 - xi2). This is required as the elements are quadratic with mid-nodes. Each interval is hard coded so that: xi1 = [1.0,0.9,0.8,0.7,0.6,0.5, etc..] xi2 = [0.0,0.1,0.2,0.3,0.4,0.5, etc..] I would like to plot the strains in colour so that the interior of the triangle is filled but I don't want to hard code the Jacobian intervals as this seems an awkward way of doing it. With strain as a function of xi1 and xi2, How can matplotlib provide a continuous interior strain plot of the triangle for all the xi1 and xi2 values from 0 to 1? Regards Alex Naysmith Alex, Perhaps if you can provide an example figure, we might be able to better help you. Right now, I am having trouble envisioning what you describe. Ben Root Ben, I have created a script that uses one isoparametric triangle as an example. The triangle nodes undergo a displacement, resulting in strains inside the triangle. The new script calculates the strains inside the triangle for a range of xi1 and xi2 barycentric coordinates and returns the global coordinates with the corresponding strain. I would like matplotlib to give me a nice interpolated colour plot of the strains inside the triangle, but as the output global coordinates are not aligned in neat rows and columns, I cannot do a straightforward meshgrid plot with imshow. http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/files There are further comments in the script that may explain things better. I want a figure like this: http://matplotlib.sourceforge.net/examples/pylab_examples/animation_demo.html But for a 6 noded quadratic triangle instead of square. The intention is to have all the triangles in the mesh display their strains with interpolated colours. Regards Alex Hello, I tried using contour and now I have a figure! http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/figure.png I can now show clearly what I'm aiming for with this figure. I want the contour fill to remain inside the triangle. There will be a whole mesh of triangles to fill. The updated sample script is here: http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/triangle_fill_v2.py I arranged my data points into square X and Y arrays along with the strains in the Z array and then simply P.contourf(X, Y, Z) As the figure shows, it's not there yet as a couple of the corners aren't filled in and there's a big fill outside the triangle. I think this is due to difficulties in translating points from the natural triangle coordinates (barycentric) to the x,y coordinates. But the contour looks correct as it's interpolated between the strain points. Regards Alex Alex, Just curious, have you checked to see if tricontourf() meets your needs? http://matplotlib.sourceforge.net/api/axes_api.html?highlight=tricontourf#matplotlib.axes.Axes.tricontourf Ben Root Ben, I've now succeeded in producing the plot I want using just contour(X,Y,Z): http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/figure2.png The script used to produce figure2 is here: http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/triangle_fill_v3.py For the X,Y and Z arrays, the upper triangle repeats the same data point. This doesn't seem to be a problem for the contour(X,Y,Z) function. The tricontourf() approach may be better, but it involves creating a triangle mesh inside each element. The next step will be to plot the strain contours for all the elements in the mesh. Regards Alex Naysmith -- Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure___ Matplotlib-users mailing list Matplotlib-users
Re: [Matplotlib-users] Plot Fill with Jacobian Coordinates
On Tue, Dec 13, 2011 at 7:12 PM, Alex Naysmith yeoman.pyt...@gmail.comwrote: On Mon, Dec 12, 2011 at 7:03 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Dec 10, 2011 at 10:36 AM, Alex Naysmith yeoman.pyt...@gmail.comwrote: Hello, I'm trying to plot the stresses in colour of a strained isoparametric element. I have a six noded triangle with vertice coordinates [(xa1,ya1),(xa2,ya2),(xa3,ya3)] = pos_a This triangle deforms and the new coordinate positions are [(xb1,yb1),(xa2,yb2),(xb3,yb3)] = pos_b The remaining nodes are mid nodes also with rest and deformed coordinate positions. To plot the edges of the triangle I use a Jacobian transformation function so that the coordinates of the triangle are in Jacobian coordinates xi1 and xi2 (with xi3 = 1 - xi1 - xi2). This is required as the elements are quadratic with mid-nodes. Each interval is hard coded so that: xi1 = [1.0,0.9,0.8,0.7,0.6,0.5, etc..] xi2 = [0.0,0.1,0.2,0.3,0.4,0.5, etc..] I would like to plot the strains in colour so that the interior of the triangle is filled but I don't want to hard code the Jacobian intervals as this seems an awkward way of doing it. With strain as a function of xi1 and xi2, How can matplotlib provide a continuous interior strain plot of the triangle for all the xi1 and xi2 values from 0 to 1? Regards Alex Naysmith Alex, Perhaps if you can provide an example figure, we might be able to better help you. Right now, I am having trouble envisioning what you describe. Ben Root Ben, I have created a script that uses one isoparametric triangle as an example. The triangle nodes undergo a displacement, resulting in strains inside the triangle. The new script calculates the strains inside the triangle for a range of xi1 and xi2 barycentric coordinates and returns the global coordinates with the corresponding strain. I would like matplotlib to give me a nice interpolated colour plot of the strains inside the triangle, but as the output global coordinates are not aligned in neat rows and columns, I cannot do a straightforward meshgrid plot with imshow. http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/files There are further comments in the script that may explain things better. I want a figure like this: http://matplotlib.sourceforge.net/examples/pylab_examples/animation_demo.html But for a 6 noded quadratic triangle instead of square. The intention is to have all the triangles in the mesh display their strains with interpolated colours. Regards Alex Hello, I tried using contour and now I have a figure! http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/figure.png I can now show clearly what I'm aiming for with this figure. I want the contour fill to remain inside the triangle. There will be a whole mesh of triangles to fill. The updated sample script is here: http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/view/head:/triangle_fill_v2.py I arranged my data points into square X and Y arrays along with the strains in the Z array and then simply P.contourf(X, Y, Z) As the figure shows, it's not there yet as a couple of the corners aren't filled in and there's a big fill outside the triangle. I think this is due to difficulties in translating points from the natural triangle coordinates (barycentric) to the x,y coordinates. But the contour looks correct as it's interpolated between the strain points. Regards Alex -- 10 Tips for Better Server Consolidation Server virtualization is being driven by many needs. But none more important than the need to reduce IT complexity while improving strategic productivity. Learn More! http://www.accelacomm.com/jaw/sdnl/114/51507609/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot Fill with Jacobian Coordinates
On Mon, Dec 12, 2011 at 7:03 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Dec 10, 2011 at 10:36 AM, Alex Naysmith yeoman.pyt...@gmail.comwrote: Hello, I'm trying to plot the stresses in colour of a strained isoparametric element. I have a six noded triangle with vertice coordinates [(xa1,ya1),(xa2,ya2),(xa3,ya3)] = pos_a This triangle deforms and the new coordinate positions are [(xb1,yb1),(xa2,yb2),(xb3,yb3)] = pos_b The remaining nodes are mid nodes also with rest and deformed coordinate positions. To plot the edges of the triangle I use a Jacobian transformation function so that the coordinates of the triangle are in Jacobian coordinates xi1 and xi2 (with xi3 = 1 - xi1 - xi2). This is required as the elements are quadratic with mid-nodes. Each interval is hard coded so that: xi1 = [1.0,0.9,0.8,0.7,0.6,0.5, etc..] xi2 = [0.0,0.1,0.2,0.3,0.4,0.5, etc..] I would like to plot the strains in colour so that the interior of the triangle is filled but I don't want to hard code the Jacobian intervals as this seems an awkward way of doing it. With strain as a function of xi1 and xi2, How can matplotlib provide a continuous interior strain plot of the triangle for all the xi1 and xi2 values from 0 to 1? Regards Alex Naysmith Alex, Perhaps if you can provide an example figure, we might be able to better help you. Right now, I am having trouble envisioning what you describe. Ben Root Ben, I have created a script that uses one isoparametric triangle as an example. The triangle nodes undergo a displacement, resulting in strains inside the triangle. The new script calculates the strains inside the triangle for a range of xi1 and xi2 barycentric coordinates and returns the global coordinates with the corresponding strain. I would like matplotlib to give me a nice interpolated colour plot of the strains inside the triangle, but as the output global coordinates are not aligned in neat rows and columns, I cannot do a straightforward meshgrid plot with imshow. http://bazaar.launchpad.net/~eckeroo/misc/mpl_scripts/files There are further comments in the script that may explain things better. I want a figure like this: http://matplotlib.sourceforge.net/examples/pylab_examples/animation_demo.html But for a 6 noded quadratic triangle instead of square. The intention is to have all the triangles in the mesh display their strains with interpolated colours. Regards Alex -- Systems Optimization Self Assessment Improve efficiency and utilization of IT resources. Drive out cost and improve service delivery. Take 5 minutes to use this Systems Optimization Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plot Fill with Jacobian Coordinates
Hello, I'm trying to plot the stresses in colour of a strained isoparametric element. I have a six noded triangle with vertice coordinates [(xa1,ya1),(xa2,ya2),(xa3,ya3)] = pos_a This triangle deforms and the new coordinate positions are [(xb1,yb1),(xa2,yb2),(xb3,yb3)] = pos_b The remaining nodes are mid nodes also with rest and deformed coordinate positions. To plot the edges of the triangle I use a Jacobian transformation function so that the coordinates of the triangle are in Jacobian coordinates xi1 and xi2 (with xi3 = 1 - xi1 - xi2). This is required as the elements are quadratic with mid-nodes. Each interval is hard coded so that: xi1 = [1.0,0.9,0.8,0.7,0.6,0.5, etc..] xi2 = [0.0,0.1,0.2,0.3,0.4,0.5, etc..] I would like to plot the strains in colour so that the interior of the triangle is filled but I don't want to hard code the Jacobian intervals as this seems an awkward way of doing it. With strain as a function of xi1 and xi2, How can matplotlib provide a continuous interior strain plot of the triangle for all the xi1 and xi2 values from 0 to 1? Regards Alex Naysmith My finite element program can be downloaded from here: http://www.pynw.org.uk/Talks?action=AttachFiledo=viewtarget=2D_FEA.zip -- Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] saving PdfPages figure before closing
I'm using the approach described the FAQ to save multiple figures to a multi-page PDF: http://matplotlib.sourceforge.net/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file The figures are produced at consecutive iterations of my algorithm, and since each iteration takes a long time I'd like to save the PDF containing the current figures at each iteration so that I can take a look. However, it seems that I can only cause the PDF to be written to disk by calling PdfPages.close(), after which I can't add any more figures. Is there any way I can write a PdfPages object to file, then add more figures and write it to file again later? \A -- FREE DOWNLOAD - uberSVN with Social Coding for Subversion. Subversion made easy with a complete admin console. Easy to use, easy to manage, easy to install, easy to extend. Get a Free download of the new open ALM Subversion platform now. http://p.sf.net/sfu/wandisco-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] adding a subplot
I'm using 0.99.3, which is from the ubuntu maverick repos. This comes up mostly when I'm drawing plots interactively from ipython. Cheers, Alex On Tue, Jun 28, 2011 at 10:44 AM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Jun 27, 2011 at 5:09 PM, Alex Flint alex.fl...@gmail.com wrote: Hi there, I'm wondering whether there is an easy way to append an additional subplot to an existing figure without losing the subplots already drawn. Currently if I do something like subplot(211); plot(...); subplot(212); plot(...); Then I get inconsistent drawing results if I try something like: subplot(313); plot(...); Cheers, Alex Yes, it is possible, but it can be messy to do so. Also, which version of matplotlib are you using? Is there a particular reason why you don't know the number of plots ahead of time? Ben Root -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] adding a subplot
Hi there, I'm wondering whether there is an easy way to append an additional subplot to an existing figure without losing the subplots already drawn. Currently if I do something like subplot(211); plot(...); subplot(212); plot(...); Then I get inconsistent drawing results if I try something like: subplot(313); plot(...); Cheers, Alex -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlibrc for [ieee] publications
i was wondering if anyone had considered making a matplotlibrc which generates plots suitable for ieee publications (specifically ieee transactions)? or any other publications for that matter. like a set of matching matplotlibrc's to journals (or some other way to achieve a similar functionality) if not, i think it would be a valuable thing to make, because it wouldnt be very hard, and would save a lot of users time/effort. specifically it would specify the dimension/dpi/font type/sizes/etc. i have a preliminary one for ieee we can use as a starting point, that can be improved. thanks alex -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlibrc for ieee publications
i was wondering if anyone had considered making a matplotlibrc which generates plots suitable for ieee publications (specifically ieee transactions)? or any other publications for that matter. like a set of matching matplotlibrc's to journals. if not, i think it would be a valuable thing to make, because it wouldnt be very hard, and would save a lot of users time/effort. specifically it would specify the dimension/dpi/font sizes/etc. i have a preliminary one we can use as a starting point, that can be improved. thanks alex -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Re : matplotlibrc for [ieee] publications
i like the module-based idea. its a bit overkill for the functionality needed, but the concise call makes it very convenient. also, installation and updating would be easy through pip/easy_install. should i start a google-code project? or does someone have a preferred way to start this? alex On Fri, 2011-04-15 at 14:09 -0400, Tony Yu wrote: On Fri, Apr 15, 2011 at 8:36 AM, Auré Gourrier aurelien.gourr...@yahoo.fr wrote: Good Idea ! I'm also using mpl for other publications than ieee and it sounds like a small mplrc data base with targeted journal specifications would be worthwhile doing ! I would be ready to contribute. Cheers, Auré Is there any reason this needs to done with rc files? I prefer to put document-specific configuration into modules. For example, you could have a module that looks like: mplrc/ __init__.py aps_fullpage.py aps_twocolumn.py ieee.py ... (`aps` could even be directory). And each module would set rc parameters using function calls; for example, aps_twocolumn.py might look like: import matplotlib.pyplot as plt plt.rc('axes', labelsize=10) plt.rc('text', fontsize=10) plt.rc('legend', fontsize=10) plt.rc('xtick', labelsize=8) plt.rc('ytick', labelsize=8) plt.rc('text', usetex=False) plt.rc('figure', figsize=(3.4039, 2.1037)) (Alternatively, you could create a separate rc file and just have the module load that rc file). The advantage of this module-based approach is that you could simply import the module whenever you need it (e.g., just add `import mplrc.aps_twocolumn` at the top of your script). If I used an rc file instead, I'd have to copy the rc file to my working directory each time, or somehow, manually load the rc file from a path. Just a suggestion. -Tony -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug in `dviread.py'
On 07.02.2011 17:17, Jouni K. Seppänen wrote: Jouni Seppänenj...@iki.fi writes: I filed this in the bug tracker: https://sourceforge.net/tracker/?func=detailaid=3175113group_id=80706atid=560720 I installed TeX Live 2010 on my Mac in order to test this, but mysteriously, the pdftex.map file does not have a line for pbkdo8y. The closest match is pbkdo8r URWBookmanL-DemiBold .167 SlantFont TeXBase1Encoding ReEncodeFont8r.encubkd8a.pfb which is the same font but with another encoding. I wonder if this indicates a problem in the way Ubuntu sets up TeX Live? Hi Jouni, currently Ubuntu still uses Texlive 2009. I also got the same bug (http://article.gmane.org/gmane.comp.python.matplotlib.general/26110) with Texlive 2010 installed directly from tug.org. I think it is unlikely that this is an Ubuntu specific problem, but I don't know for sure whether this file gets generated during the installation or is unmodified from the Texlive distribution. Greetings Alexander -- The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bug in dviread?
Hello to all, using a standard python install on Ubuntu 10.04 the example fails to produce a figure. Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. import matplotlib matplotlib.__version__ '0.99.1.1' Test case in python: from numpy import sin, cos import matplotlib import matplotlib.pyplot as plt plt.matplotlib.rc('text', usetex = True) import pylab fig = plt.figure() ax = fig.add_subplot(111) t = pylab.linspace(0,10,400) ax.plot(t, sin(3*t), '-', t, sin(0.3*t**2), '--', t, cos(t), '-.') ax.legend((r'$A^{\omega}$', r'$A^{2\omega}$', r'$A^{3\omega}$'), shadow = False, loc = (0.75, 0.1)) ax.set_xlabel(r'$\gamma_1 + \gamma_2$', {'fontsize' : 20 }) ax.set_ylabel(r'$A^{n\omega}$ (dB)', {'fontsize' : 20 }) fig.savefig(filename='test.pdf') This leads to the following traceback: Traceback (most recent call last): File test.py, line 18, in module fig.savefig(filename='test.pdf') File /usr/lib/pymodules/python2.6/matplotlib/figure.py, line 1032, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/pymodules/python2.6/matplotlib/backend_bases.py, line 1476, in print_figure **kwargs) File /usr/lib/pymodules/python2.6/matplotlib/backend_bases.py, line 1334, in print_pdf return pdf.print_pdf(*args, **kwargs) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py, line 2025, in print_pdf self.figure.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axes.py, line 1735, in draw a.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axis.py, line 742, in draw tick.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File /usr/lib/pymodules/python2.6/matplotlib/axis.py, line 196, in draw self.label1.draw(renderer) File /usr/lib/pymodules/python2.6/matplotlib/text.py, line 553, in draw self._fontproperties, angle) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py, line 1431, in draw_tex psfont = self.tex_font_mapping(dvifont.texname) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_pdf.py, line 1264, in tex_font_mapping dviread.PsfontsMap(dviread.find_tex_file('pdftex.map')) File /usr/lib/pymodules/python2.6/matplotlib/dviread.py, line 668, in __init__ self._parse(file) File /usr/lib/pymodules/python2.6/matplotlib/dviread.py, line 701, in _parse self._register(words) File /usr/lib/pymodules/python2.6/matplotlib/dviread.py, line 727, in _register assert encoding is None AssertionError I assume that the errors happens during parsing of the file 8r.enc (http://tug.org/fontname/8r.enc). This file belongs to TexLive 2010 and can also be found identically in MikTeX 2.9. I could only reproduce the error in Linux so far. Any help would be appreciated. Alexander -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] (no subject)
Hi, While moving from Matlab to Numpy/Scipy/Matplotlib I need sometimes to work with Matlab figures. It would be nice if we could load Matlab figures in Python, extract the data and some basic parameters of how it was looking in Matlab and create its clone in matplotlib. At present the Matlab figures are MAT files and in the near future it will be HDF5, both formats are loadable. However, I have not found any reference for such attempts to load and parse the FIG files. As a beginner I find it difficult to write a large piece of code. However, if there are other interested users that can cooperate on such, I'd gladly contribute some hours for this task. Meanwhile, to show the proof-of-concept attempt is attached below. All your useful comments and suggestions are very welcome. Thank you, Alex # loadfig.py -- # Loadfig loads simple Matlab figures as MAT files and plots the lines using matplotlib import numpy as np from scipy.io import loadmat import matplotlib.pyplot as plt def lowest_order(d): lowestsc_order(hgstruct) finds the handle of axes (i.e. children of figure handles, etc.) while not 'graph2d.lineseries' in d['type']: d = d['children'][0][0] return d def get_data(d): get_data(hgstruct) extracts XData, YData, Color and Marker of each line in the given axis Parameters -- hgstruct : structure obtained from lowest_order(loadmat('matlab.fig')) xd,yd,dispname,marker,colors = [],[],[],[],[] for i in d: if i['type'] == 'graph2d.lineseries': xd.append(i['properties'][0][0]['XData'][0][0]) yd.append(i['properties'][0][0]['YData'][0][0]) dispname.append(i['properties'][0][0]['DisplayName'][0][0]) marker.append(i['properties'][0][0]['Marker'][0][0]) colors.append(i['properties'][0][0]['Color'][0][0]) return np.asarray(xd),np.asarray(yd),dispname,np.asarray(marker).astype('S1'),colors def plot_data(xd,yd,dispname=None,marker=None,colors=None): plot_data(xd,yd,dispname=None,marker=None,colors=None) plots the data sets extracted by get_data(lowest_order(loadmat('matlab.fig'))) Parameters -- xd,yd : array_like data arrays dispname : array of strings to be used in legend, optional marker : array of characters markers, e.g. ['o','x'], optional colors : array of color sets in RGB, e.g. [[0,0,1],[1,0,0]], optional for i,n in enumerate(xd): plt.plot(xd[i].T,yd[i].T,color=tuple(colors[i]),marker=marker[i],linewidth=0) plt.legend(dispname) plt.show() def main(filename): main(filename) loads the filename (with the extension .fig) which is Matlab figure. At the moment only simple 2D lines are supported. Examples --- loadfig('matlab.fig') # is equivalent to: d = loadmat(filename) d = d['hgS_07'] xd,yd,dispname,marker,colors = get_data(lowest_order(d)) plot_data(xd,yd,dispname,marker,colors) d = loadmat(filename) # ver 7.2 or lower: d = d['hgS_07'] xd,yd,dispname,marker,colors = get_data(lowest_order(d)) plot_data(xd,yd,dispname,marker,colors) if __name__ == __main__: import sys import os try: filename = sys.argv[1] main(filename) except: print(Wrong file) # - EOF loadfig.py --- # Alex Liberzon Turbulence Structure Laboratory [http://www.eng.tau.ac.il/efdl] School of Mechanical Engineering Tel Aviv University Ramat Aviv 69978 Israel Tel: +972-3-640-8928 Lab: +972-3-640-6860 (telefax) E-mail: alex...@eng.tau.ac.il -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Font not carrying through Py2Exe
Thank you very much for the help, I'm sorry I didn't reply to you. I ended up doing what you recommend against, which is I took my fontlist.cache and copied it to the other computers C:\Documents and Settings\username\.matplotlib folder. This worked, maybe because all the computers here have the same font that for some reason didn't get included in the fontlist for everyone else. I know it's not perfect and that if I tried to get the program to work for anyone outside of work it would probably crash horribly, but it works now so I think I'll just leave it. Thank you very much Mike, you might not remember but you were the one that taught me how to get it into New Century Schoolbook in the first place. http://old.nabble.com/Changing-the-font-td28111472.html#a28118916 Here it is , for old times sake. Michael Droettboom-3 wrote: On 01/13/2011 11:38 AM, Alex S wrote: Hi there, I've made a program that makes plots using New Century Schoolbook Lt Std font. I did this by inserting this into the matplotlibrc file: font.family : New Century Schoolbook LT Std # serif #sans-serif There's also a fontlist.cache file that I think points to it when it says: . . . (dp283 g12 g45 sg14 S'New Century Schoolbook LT Std' p284 sg16 I400 sg17 g13 sg18 . . . This all works fine on my computer. But I'm trying to make it run on other people's computers (off a network drive) but when I do the plots all go back into Ariel font and all the spacing and stuff gets screwed up. Running the exact same exe from the same place, my computer continues to make them with the correct font. I have copied the matplotlibrc file and the fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data folder in the dist folder (from py2exe) but that didn't work. Does anyone have any ideas for fixing this stuff? I think it might just be a matter of including the right files in the Py2Exe setup file but I don't know which ones. Or maybe changing how I select the font, which was a roundabout way of doing it from the start. The fontList.cache file maps from the properties (names, weights, slants) etc. of the fonts available on a particular system to their file path. You should definitely not ship this file with the exe, but rather allow it to be regenerated from scratch on each system, since the selection and locations of fonts is very likely to be different. I think New Century Schoolbook is one of the fonts that ships with Windows, so you can probably count on it being there. If not, you need to ship the font as part of the exe by adding it to mpl-data/fonts/ttf and then following the instructions to include the fonts given here: http://www.py2exe.org/index.cgi/MatPlotLib When I run the plots (successfully on my computer) it says this at one point: c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982: UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a Type 3 font. The entire font will be embedded in the output. Maybe that has somethign to do with what's going on? I don't think that's related. All this means is that when it embeds the font into the PDF file, it has to embed the entire thing rather than only the characters that are being used. (Resulting in a larger PDF file, but otherwise fine.) To avoid this message, you can set the rcParam pdf.fonttype to 42. Cheers, Mike Thanks a lot, Alex -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Font-not-carrying-through-Py2Exe-tp30663871p30676209.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Font not carrying through Py2Exe
Hi there, I've made a program that makes plots using New Century Schoolbook Lt Std font. I did this by inserting this into the matplotlibrc file: font.family : New Century Schoolbook LT Std # serif #sans-serif There's also a fontlist.cache file that I think points to it when it says: . . . (dp283 g12 g45 sg14 S'New Century Schoolbook LT Std' p284 sg16 I400 sg17 g13 sg18 . . . This all works fine on my computer. But I'm trying to make it run on other people's computers (off a network drive) but when I do the plots all go back into Ariel font and all the spacing and stuff gets screwed up. Running the exact same exe from the same place, my computer continues to make them with the correct font. I have copied the matplotlibrc file and the fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data folder in the dist folder (from py2exe) but that didn't work. Does anyone have any ideas for fixing this stuff? I think it might just be a matter of including the right files in the Py2Exe setup file but I don't know which ones. Or maybe changing how I select the font, which was a roundabout way of doing it from the start. When I run the plots (successfully on my computer) it says this at one point: c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982: UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a Type 3 font. The entire font will be embedded in the output. Maybe that has somethign to do with what's going on? Thanks a lot, Alex -- View this message in context: http://old.nabble.com/Font-not-carrying-through-Py2Exe-tp30663871p30663871.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] savefig eps error
today i produced an image that failed to save to eps. i can save the file in pdf, but i get the same error if i try to use pdf2ps. png works too, but its not vector. not sure if its important, but the image has 401 lines, with 500 points each. the image is produced from a bunch of data files and im not sure how to most effectively send this over email ( in case you all wanted to re-produced the error). the main error is Error: /nocurrentpoint in --lineto-- here is the whole error thanks alex -- In [774]: savefig ('output.eps', format='eps') GPL Ghostscript 8.70: Unrecoverable error, exit code 1 RuntimeError: ghostscript was not able to process your image. Here is the full report generated by ghostscript: GPL Ghostscript 8.70 (2009-07-31) Copyright (C) 2009 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading CenturySchL-Roma font from /var/lib/defoma/gs.d/dirs/fonts/c059013l.pfb... 3081280 1718017 6003072 4188814 1 done. Error: /nocurrentpoint in --lineto-- Operand stack: 178.896 120.362 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 % oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop 1739 1 3 %oparray_pop --nostringval-- % errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- Dictionary stack: --dict:1154/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:5/6(ro)(L)-- --dict:178/300(L)-- --dict:44/200(L)-- --dict:7/7(L)-- Current allocation mode is local Last OS error: 2 Current file position is 34416 -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Not using exponents on y-axis of log graphs
Hi there, I've got a program that generates a bunch of plots with logarithmic charts. Matplotlib handles them great, but it seems to by default label the y axis ticks 10^0, 10^1, 10^2 etc. Is there an way to make it spell out these numbers instead (ie 1, 10, 100 etc)? I guess I could make custom ticks for every one, but the graph is not always the same and if it could do it automatically it would be much better. Thanks a lot, Alex -- View this message in context: http://old.nabble.com/Not-using-exponents-on-y-axis-of-log-graphs-tp28155571p28155571.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Not using exponents on y-axis of log graphs
Ah thank you very much, that works fine except for decimals... (.1, .01, .001 etc all show as 0). Is there a way to show these as well (preferably without showing all the rest of the numbers as 1.000, 10.000, 100.000)? Sorry if this is a very newbie question... I don't know what symbol does what on the string formatter, is there a web site somewhere that lays it all out? As per usual, http://matplotlib.sourceforge.net/api/ticker_api.html the manual has just confused me... -- View this message in context: http://old.nabble.com/Not-using-exponents-on-y-axis-of-log-graphs-tp28155571p28156608.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Not using exponents on y-axis of log graphs
Thanks again to Mike who explained my problems off list. For other people trying to do something similar, http://docs.python.org/library/stdtypes.html#string-formatting here is the page describing python string formats, and the format i was looking for to show decimals was '%g' (rather than '%d' which was for integers and so truncated decimals). Thanks guys, Alex Alex S wrote: Ah thank you very much, that works fine except for decimals... (.1, .01, .001 etc all show as 0). Is there a way to show these as well (preferably without showing all the rest of the numbers as 1.000, 10.000, 100.000)? Sorry if this is a very newbie question... I don't know what symbol does what on the string formatter, is there a web site somewhere that lays it all out? As per usual, http://matplotlib.sourceforge.net/api/ticker_api.html the manual has just confused me... -- View this message in context: http://old.nabble.com/Not-using-exponents-on-y-axis-of-log-graphs-tp28155571p28156753.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Changing the font
I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. Thanks for the debug tip, I don't think posting the whole thing is necessary because this line seems to be the problem: findfont: Could not match :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf So I guess the font's missing from the folder. Can I add it somehow? Michael Droettboom-3 wrote: Can you set verbose.level to debug-annoying in your matplotlibrc file, and then send the output to this list. That may help us track down where the font lookup is failing. Also, what platform and version of matplotlib are you running? Mike Alex S wrote: Hi, sorry I wasn't too clear... I changed that, but I don't seem to be able to choose between the different serif fonts, it just always gives me the default... Alex S wrote: Hi there, I'm trying to change the font default on my graph to New Century Schoolbook. I'm trying to do this by editing the matplotlibrc file. Unfortunately, although I'm able to change the font.family, I can't figure out how to make it use something other than the default in the family... I tried changing the list further down to only include the font I want, like this: font.serif : New Century Schoolbook #Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif (note I commented out the other fonts, just rearranging the list to put New Century Schoolbook first didn't seem to work either) Could anyone tell me what I'm doing wrong? Thanks a lot! Alex -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141094.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Changing the font
Ah ok, I've sent it on to you. I've just tried setting font.family to New Century Schoolbook directly but it generates something similar. I'm starting to think part of the problem is that I've set the home directory to U: somehow, U: being a shared drive which doesn't have a font directory... I don't know how I set this, it's not mentioned in the rc file anywhere that I can see... Michael Droettboom-3 wrote: It would still be helpful to see the whole listing (send it to me offlist) because that will indicate where fonts are being looked for, and hopefully *why* this is failing. It should search for fonts in the standard Windows location (usually C:\Windows\Fonts). Have you tried setting font.family to New Century Schoolbook directly? (I wonder if the secondary lookup is failing). Cheers, Mike Alex S wrote: I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. Thanks for the debug tip, I don't think posting the whole thing is necessary because this line seems to be the problem: findfont: Could not match :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf So I guess the font's missing from the folder. Can I add it somehow? Michael Droettboom-3 wrote: Can you set verbose.level to debug-annoying in your matplotlibrc file, and then send the output to this list. That may help us track down where the font lookup is failing. Also, what platform and version of matplotlib are you running? Mike Alex S wrote: Hi, sorry I wasn't too clear... I changed that, but I don't seem to be able to choose between the different serif fonts, it just always gives me the default... Alex S wrote: Hi there, I'm trying to change the font default on my graph to New Century Schoolbook. I'm trying to do this by editing the matplotlibrc file. Unfortunately, although I'm able to change the font.family, I can't figure out how to make it use something other than the default in the family... I tried changing the list further down to only include the font I want, like this: font.serif : New Century Schoolbook #Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif (note I commented out the other fonts, just rearranging the list to put New Century Schoolbook first didn't seem to work either) Could anyone tell me what I'm doing wrong? Thanks a lot! Alex -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141683.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Changing the font
Yup, thanks for the help everyone Michael Droettboom-3 wrote: For the benefit of future users Googling this problem -- After an off-list discussion, we realized there were a couple of fonts on Alex' system with the names Century Schoolbook and New Century Schoolbook LT Std. Using one of those names instead resolved the problem. Mike Alex S wrote: Ah ok, I've sent it on to you. I've just tried setting font.family to New Century Schoolbook directly but it generates something similar. I'm starting to think part of the problem is that I've set the home directory to U: somehow, U: being a shared drive which doesn't have a font directory... I don't know how I set this, it's not mentioned in the rc file anywhere that I can see... Michael Droettboom-3 wrote: It would still be helpful to see the whole listing (send it to me offlist) because that will indicate where fonts are being looked for, and hopefully *why* this is failing. It should search for fonts in the standard Windows location (usually C:\Windows\Fonts). Have you tried setting font.family to New Century Schoolbook directly? (I wonder if the secondary lookup is failing). Cheers, Mike Alex S wrote: I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. Thanks for the debug tip, I don't think posting the whole thing is necessary because this line seems to be the problem: findfont: Could not match :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf So I guess the font's missing from the folder. Can I add it somehow? Michael Droettboom-3 wrote: Can you set verbose.level to debug-annoying in your matplotlibrc file, and then send the output to this list. That may help us track down where the font lookup is failing. Also, what platform and version of matplotlib are you running? Mike Alex S wrote: Hi, sorry I wasn't too clear... I changed that, but I don't seem to be able to choose between the different serif fonts, it just always gives me the default... Alex S wrote: Hi there, I'm trying to change the font default on my graph to New Century Schoolbook. I'm trying to do this by editing the matplotlibrc file. Unfortunately, although I'm able to change the font.family, I can't figure out how to make it use something other than the default in the family... I tried changing the list further down to only include the font I want, like this: font.serif : New Century Schoolbook #Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif (note I commented out the other fonts, just rearranging the list to put New Century Schoolbook first didn't seem to work either) Could anyone tell me what I'm doing wrong? Thanks a lot! Alex -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net 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 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu
Re: [Matplotlib-users] Changing the font
Hi, sorry I wasn't too clear... I changed that, but I don't seem to be able to choose between the different serif fonts, it just always gives me the default... Alex S wrote: Hi there, I'm trying to change the font default on my graph to New Century Schoolbook. I'm trying to do this by editing the matplotlibrc file. Unfortunately, although I'm able to change the font.family, I can't figure out how to make it use something other than the default in the family... I tried changing the list further down to only include the font I want, like this: font.serif : New Century Schoolbook #Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif (note I commented out the other fonts, just rearranging the list to put New Century Schoolbook first didn't seem to work either) Could anyone tell me what I'm doing wrong? Thanks a lot! Alex -- View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28112278.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] xlim with dates
Hi there, does anyone know if there's a simple way to set an axis limit to a date? viewlim_to_dt() looks promising, but I can't figure out how to use it... Thanks a lot, Alex -- View this message in context: http://old.nabble.com/xlim-with-dates-tp27881612p27881612.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] xlim with dates
Ah perfect, thanks a lot, sorry for the mundane question :) -- View this message in context: http://old.nabble.com/xlim-with-dates-tp27881612p27882177.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Making tick marks of a secondary axis line up with the primary axis
Hi there, I'm trying to make a plot with two y axes. I'm able to do that no problem, but what I'd really like to do now is make the tick marks line up for them both so that they both use the same grid. Is there a simple way to do this? Basically, I want to force the number of tick marks on the right hand axis to be the same as on the left hand axis, and I'd like it to select nice numbers to do so (ie not intervals of .358 or something). Also, on a somewhat related note, is there a simple way to force the y ticks to start at 0 rather than some other value? Thanks a lot, Alex -- View this message in context: http://old.nabble.com/Making-tick-marks-of-a-secondary-axis-line-up-with-the-primary-axis-tp27854166p27854166.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Making an Axis Label like a legend
Hmm I think I could do this with TextWithDash, but I can't manage to use it... I go: CumGasTxt = fig.text(0.5, 0.5, 'Cumulative Gas (MCF)', withdash=True) and it says AttributeError: Unknown property withdash. I tried changing fig to ax1, but although that doesn't spit out an error, it doesn't display anything. Does anyone know what I'm doing wrong? Thanks a lot, Alex -- View this message in context: http://old.nabble.com/Making-an-Axis-Label-like-a-legend-tp27826934p27841250.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Multiple Y Axes redux
Hi there, I know this has been discussed in the past, but I was looking through some of the history and I'm not sure what the exact situation is. I think multiple y axes on the same side of the graph is unsupported officially, but can be hacked together somehow, is that right? Is there an example of such a hacked together method somewhere that I could look at? There may be a simpler way to do what I'm trying to do... I'm not trying to make several different axes, I'm trying to have a logarithmic axis on the left, but have three different scales (ie 1, 10, 100 on one, 10, 100, 1000 on another, 100, 1000, 1 on the final one). Is there a way to manually label the ticks on the axis 1 10 1000 and so on? I think that might do in a pinch, then I could just divide the plotted values by the correct scaling factor. Do you guys think that would be the way to go? And if that is possible, is it possible to have the tick labels be different colours for the different numbers so it shows which scale is for which line on the graph? I guess I'm not hopeful for that... Instead could I put in a bit at the bottom of the graph to highlight which markers go to which axis? Something like this (for x, o and * data markers on the chart): | | | | | | | | |_* | |_o |_x Thanks a lot, sorry if this question is kind of hard to follow... Please let me know if more clarification is needed! Alex -- View this message in context: http://old.nabble.com/Multiple-Y-Axes-redux-tp27817369p27817369.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Making an Axis Label like a legend
Hello again, I've got a question about axis labels, specifically y axis labels for multiple lines. What I'd ideally like to do is take something like the legends shown in the attached picture, rotate them 90 degrees counter clockwise, then stick them to the left of the Y axes to use it as a label there. I don't think there is any way to rotate the legend, but is there anything I could do to get a similar effect? Basically I'd like the legend out of the plot area and into the y axis title, but it needs to show which line is which. Having the sample line and marker in the title would be perfect, but I guess just having the words in the corresponding colour would work too. Thanks a lot! Alex http://old.nabble.com/file/p27826934/test.png -- View this message in context: http://old.nabble.com/Making-an-Axis-Label-like-a-legend-tp27826934p27826934.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] basemap Cairo exception
Not sure if this is the right place to send this, can't seem to find a dedicated bugs list or issue tracker. Or much discussion regarding the basemap toolkit at all really. Trying to savefig some Basemap instances causes the following exception in the Cairo backend. Seems to work alright using the Agg backend but the fill doesn't seem to come out properly. The sea gets colored as well as the continents. Traceback (most recent call last): File map.py, line 48, in module plt.savefig(map.png, dpi=100) File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 286, in savefig return fig.savefig(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 1033, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1301, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py, line 406, in print_png self.figure.draw (renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 833, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1539, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/patches.py, line 285, in draw renderer.draw_path(gc, tpath, affine, rgbFace) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py, line 140, in draw_path raise ValueError(The Cairo backend can not draw paths longer than 18980 points.) ValueError: The Cairo backend can not draw paths longer than 18980 points. Here's a short reduction import matplotlib matplotlib.use(Cairo) from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt map = Basemap(projection='ortho', llcrnrlon=-12.7, llcrnrlat=49, urcrnrlon=4.7, urcrnrlat=61, lat_0 = 50, lon_0 = 0, lat_ts=50, resolution='i') map.drawcoastlines(linewidth=0.5) map.drawcountries(linewidth=0.5) map.drawstates(linewidth=0.5) map.drawmapboundary() plt.savefig(map.png, dpi=100) -- Alex Stapleton - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap Cairo exception
2008/7/16 Jeff Whitaker [EMAIL PROTECTED]: Alex Stapleton wrote: Not sure if this is the right place to send this, can't seem to find a dedicated bugs list or issue tracker. Or much discussion regarding the basemap toolkit at all really. Trying to savefig some Basemap instances causes the following exception in the Cairo backend. Seems to work alright using the Agg backend but the fill doesn't seem to come out properly. The sea gets colored as well as the continents. Traceback (most recent call last): File map.py, line 48, in module plt.savefig(map.png, dpi=100) File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 286, in savefig return fig.savefig(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 1033, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1301, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py, line 406, in print_png self.figure.draw (renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 833, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1539, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/patches.py, line 285, in draw renderer.draw_path(gc, tpath, affine, rgbFace) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py, line 140, in draw_path raise ValueError(The Cairo backend can not draw paths longer than 18980 points.) ValueError: The Cairo backend can not draw paths longer than 18980 points. Here's a short reduction import matplotlib matplotlib.use(Cairo) from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt map = Basemap(projection='ortho', llcrnrlon=-12.7, llcrnrlat=49, urcrnrlon=4.7, urcrnrlat=61, lat_0 = 50, lon_0 = 0, lat_ts=50, resolution='i') map.drawcoastlines(linewidth=0.5) map.drawcountries(linewidth=0.5) map.drawstates(linewidth=0.5) map.drawmapboundary() plt.savefig(map.png, dpi=100) Alex: I don't have the Cairo backend installed, but I bet it would work if you changed resolution='i' to resolution='l'. Seems like a pretty severe limitation of the backend though. -Jeff I suppose it's not up to matplotlib to work around silly limits in Cairo :) What about the fill issue with the Agg backend when doing zoomed in ortho maps? Am I doing something wrong? (actually hit reply all this time) - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with matplotlib and pdflatex
I believe I have fixed the problem in the latest svn versions, both on the maintenance branch and on the trunk. Please try the latest version Thanks for your help, Jouni. That seems to have fixed the problem. Best, Alex - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Problem with matplotlib and pdflatex
I'm trying to use some matplotlib-generated pdfs in a pdflatex document, and seeing some extremely weird and disruptive size effects. The resulting pdfs can be seen at http://research.janelia.org/coventry/paper.pdf http://research.janelia.org/coventry/paper-small.pdf The first results from the code \begin{figure} \centering \subfigure[Prior distribution]{\label{fig:prior-graph} \includegraphics[width=6in]{prior-example} } \subfigure[Posterior distribution]{\label{fig:posterior-graph} \includegraphics[width=6in]{posterior-example} } \end{figure} and the second from the same code with width=5cm. The two pdfs I'm trying to include are at http://research.janelia.org/coventry/prior-example.pdf and http://research.janelia.org/coventry/posterior-example.pdf It doesn't matter what order I include them in, I get the same size effects. If I generate postscript files with matplotlib and convert them to pdfs, I don't get this problem. So I have a workaround, but I would like to know how to create usable pdfs directly, and thought reporting this might be useful to matplotlib development. Best, Alex - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Looking for a way to save a graph
On Thu, August 23, 2007 5:33 pm, David Tremouilles wrote: I would like to save a matplotlib figure (data, title and axes label, plot properties, ...) to load it later on for modification. Something like figure.savelall(file.matplot) and later on do a figure.loadall(file.matplot) using an empty figure. I am but a humble newbie, but why not simply take your figure object/reference and Pickle it (see http://docs.python.org/lib/module-pickle.html)? -- Alex Pounds (Creature) .~. http://www.alexpounds.com/ /V\ http://www.ethicsgirls.com/ // \\ Variables won't; Constants aren't /( )\ ^`~'^ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pylib BaseHTTPRequestHandler
Hi Everyone, I am trying to find a way of producing a graph in pylib and then returning it as a graphic via a simple BaseHTTPRequestHandler webserver. I don't appear to be able to find any documentation on this, although I am sure it must be possible to achieve this! I know that I can produce a temporary file in pylib and then load it and output it in BaseHTTPRequestHandler but I am looking to avoid this unnecessary step! Many thanks, Alex - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib + mpi4py on win32
Hi, Has anyone had experience running matplotlib in conjunction with mpi4py/mpich2 on Windows? The following program hangs (python 2.4), even when running with mpiexec -n 1 python test.py: import pylab from mpi4py import MPI pylab.plot([1,2,3]) pylab.show() but runs once the line pylab.show() is commented out. I haven't seen that behavior on Linux or Mac OS X. Thanks in advance for your help. --Alex - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users