[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] How to do million data-point plots with Matplotlib?
I have been working on a program that uses Matplotlib to plot data consisting of around one million points. Sometimes the plots succeed but often I get an exception: OverFlowError: Agg rendering complexity exceeded. I can make this message go away by plotting the data in chunks as illustrated in the demo code below. However, the extra code is a chore which I don't think should be necessary - I hope the developers will be able to fix this issue sometime soon. I know that the development version has some modifications to addressing this issue. I wonder if it is expected to make the problem go away? By the way, this plot takes about 30 seconds to render on my I7 2600k. The main program reaches the show() statement quickly and prints Done plotting?. Then I see that the program reaches 100% usage on one CPU core (4 real, 8 virtual on the 2600k) until the plot is displayed. I wonder if there is any way to persuade Matplotlib to run some of the chunks in parallel so as to use more CPU cores? Plotting something other than random data, the plots run faster and the maximum chunk size is smaller. The maximum chunk size also depends on the plot size - it is smaller for larger plots. I am wondering if I could use this to plot course and fine versions of the plots. The course plot is zoomed in version of the small-sized raster. That would be better than decimation as all the points would at least be there. Thanks in advance, David --- start code - ## Demo program shows how to chunk plots to avoid the exception: ## ## OverflowError: Agg rendering complexity exceeded. ## Consider downsampling or decimating your data. ## ## David Smith December 2011. from pylab import * import numpy as np nPts=600100 x = np.random.rand(nPts) y = np.random.rand(nPts) ## This seems to always succeed if Npts = 2, but fails ## for Npts 3. For points between, it sometimes succeeds ## and sometimes fails. figure(1) plot (x, y) ## Chunking the plot alway succeeds. figure(2) chunk_size=2 iStarts=range(x.size/chunk_size) for iStart in iStarts: print Plotting chunk starting at %d\n % iStart plot(x[iStart:iStart+chunk_size], y[iStart:iStart+chunk_size], '-b') left_overs = nPts % chunk_size if left_overs 0: print Leftovers %d points\n % left_overs plot(x[-left_overs-1:], y[-left_overs-1:], '-r') print done plotting? show() -- end code Please don't reply to this post It is rediculous to plot 1 million points on screen. I am routinely capturing million-point traces from oscilloscopes and other test equipment and to I need to be able to spot features in the data (glitches if you will) that may not show up plotting decimated data. I can then zoom the plot to inspect these features. -- 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
Re: [Matplotlib-users] Plotting basemap on top of other data
HI, My initial thought was that you need to use the zorder keyword argument and set the zorder to a large value. However, the more I thought about it, I'm not really sure how you are plotting the satellite data. Can you provide a code snippet? PTM --- Patrick Marsh Ph.D. Student / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com On Fri, Dec 9, 2011 at 6:58 AM, Laat de, Jos (KNMI) jos.de.l...@knmi.nl wrote: I am working with (geostationary) satellite data, and one of the things I want to do is plot a map (coastlines) on top of the satellite image. As an IDL user I know how to do this in IDL (although in IDL it is a bit of a hassle), but I don’t seem to be able to figure out how this could be done in python. The satellite data consists of a rectangular field of N by N pixels. The data is already converted to bitmap RGB values. I have figured out how this can be written to a bitmap image like PNG or JPG. I further figured out how to do the satellite projection in Basemap, and how to plot Basemap coastlines. However, the Basemap appears to have a non-transparent background, which overplots all bitmap data if I plot the Bitmap data first. I had hoped that there would be some transparency setting in Basemap, but alas. (ps. Keep in mind that I do not want to use some contour filling routine for plotting the satellite data. I want to retain the original N x N pixels and image size) -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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