Re: [Matplotlib-users] Export plot to Word
Cheng-Kong Wu wrote: I created several plots and want to export them to a Word file sequentially, how can I do that? Why Word? It's a horrible file format and very difficult to deal with. Why not just use one of the PDF backends (I don't think I'm making that up, there are PDF back ends for Matplotlib, right?) If you really insist on trying with Word, your best bet is to interact with Word via the win32com package... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3d graph combined with a 2D contour
Hi people Using the axes3d functionality, I am able to create 3D graph of desired mathematical functions ala the cookbook example. However, it would be useful to be able to have a 2D contour plot upon the xy plane of a graph at the same time. I've googled to no avail and wondered if someone can point me in the right direction Thanks Andy - 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] LinearSegmentedColormap
Michael Hearne wrote: Ryan - Thanks for your response. Shouldn't a color dictionary have 4 columns - a value, and the corresponding R,G,B values? If I understand your response, the row with 0.2 as the first column has only two values. How does LinearSegmentedColormap derive an RGB triplet from those two numbers? Not quite. I'm pretty sure I was a little vague in my last message, so let me be more concrete. Here's an example of a 5 gray level color map data dictionary: _Gray5_data = {'blue': [(0.0, 0.42352941176470588, 0.42352941176470588), (0.25, 0.5, 0.5), (0.5, 0.6588235294117647, 0.6588235294117647), (0.75, 0.81568627450980391, 0.81568627450980391), (1.0, 0.93725490196078431, 0.93725490196078431)], 'green': [(0.0, 0.42352941176470588, 0.42352941176470588), (0.25, 0.5, 0.5), (0.5, 0.6588235294117647, 0.6588235294117647), (0.75, 0.81568627450980391, 0.81568627450980391), (1.0, 0.93725490196078431, 0.93725490196078431)], 'red': [(0.0, 0.42352941176470588, 0.42352941176470588), (0.25, 0.5, 0.5), (0.5, 0.6588235294117647, 0.6588235294117647), (0.75, 0.81568627450980391, 0.81568627450980391), (1.0, 0.93725490196078431, 0.93725490196078431)]} Note that the dictionary contains one list each for red, green, and blue. Each entry in the a list for the color corresponds to an entry in the table. This entry has 3 pieces of information: The first (item #1) is the corresponding normalized data value for this color (between 0 and 1). The next two values are normalized color values, the first if the actual data value is below the value in item #1 and the 2nd if it is above. In the case of the one above, the color is the same regardless. So, for example, a normalized data value of 0.25 gets an RGB tuple of (0.5333,0.5333,0.5333). HTH, Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma - 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] Watermarking figures/axes
On Thu, Mar 6, 2008 at 3:00 AM, [EMAIL PROTECTED] wrote: Anthony Floyd [EMAIL PROTECTED] writes: I would like to 'watermark' a plot. That is, display an image 'under' several lines. [...] I've tried using figure.figimage, but that only draws the watermark 'outside' the plot area. Fair enough. The background of the axes object is called a frame, and you want to not draw it at all (pass frameon=False to add_axes) or make it translucent: fig=figure(...) fig.figimage(...) ax=fig.add_subplot(...) ax.get_frame().set_alpha(0.5) Thanks! That essentially works as expected. Anthony. - 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] Compiler error on OS X 10.5.2 in agg
Hi Stephane, [CC'd to the matplotlib-users list in case others will find this useful.] I got the same problem. Can you tell me where you specified the -Os option to gcc to escape the problem? So the compile that command that failed is printed right above the error message it generated. (The long line that starts with 'gcc' ...). I just copied this command, edited the -O3 to an -Os, and pasted that command-line back into the terminal. Total low-tech hack, as I didn't want to much with the setup.py file to fix compile flags on a per-file basis. After that file is compiled manually, you can re-run 'python setup.py build', and it will start up at the next step after the error. I got the same error in another step, which was a bit trickier to fix, because for some reason, src/_image.cpp gets copied to src/image.cpp on a temporary basis, and then compiled. (I presume the file isn't also modified?) But after the compile errors out, the copy is deleted, so just pasting in the offending gcc command doesn't work. So I had to manually copy src/_image.cpp to scr/image.cpp, and then paste in the modified gcc command. Ugh! I'd really love some help reducing this to a test case that I can send to Apple. Zach On Mar 13, 2008, at 12:16 PM, Stephane Raynaud wrote: Hi, I got the same problem. Can you tell me where you specified the -Os option to gcc to escape the problem? On Mon, Mar 10, 2008 at 4:35 AM, Zachary Pincus [EMAIL PROTECTED] wrote: Hello, I just tried to compile the SVN head of matplotlib (r4994) from source on OS X 10.5.2 (with source builds of python 2.5.2 and the SVN head of numpy), and ran into an internal compiler error in the agg code. (pkgconfig 0.23 and wxPython 2.8.7.1 also present and accounted for.) Here's the compile line and error: building 'matplotlib.backends._backend_agg' extension gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno- fused- madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict- prototypes -I/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/numpy/core/include -I/usr/X11/include/ libpng12 -I/usr/local/include -I/usr/include -I/usr/X11R6/include - I. -I/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/ site-packages/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/ X11/include/freetype2 -I/usr/X11/include -I/usr/local/include -I/ usr/ include -I/usr/X11R6/include -I. -I/Library/Frameworks/ Python.framework/Versions/2.5/include/python2.5 -c src/_image.cpp -o build/temp.macosx-10.4-i386-2.5/src/_image.o cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++ src/_image.cpp: In member function 'Py::Object _image_module::from_images(const Py::Tuple)': src/_image.cpp:842: error: insn does not satisfy its constraints: (insn 2573 1070 2574 126 agg24/include/agg_color_rgba.h:268 (set (mem:QI (plus:SI (reg/f:SI 6 bp) (const_int -280 [0xfee8])) [0 SR.2969+0 S1 A8]) (reg:QI 5 di)) 56 {*movqi_1} (nil) (nil)) src/_image.cpp:842: internal compiler error: in reload_cse_simplify_operands, at postreload.c:391 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://developer.apple.com/bugreporter for instructions. This seems to be an agg and OS X error; it's cropped up here: http://trac.osgeo.org/mapserver/ticket/2368 and John Hunter reported it on the agg list here: http://article.gmane.org/gmane.comp.graphics.agg/3963 Unfortunately, the error appears to either not have been fixed by the 10.5.1 update, as suggested in the email thread cited above, or the error re-appeared in 10.5.2. Changing the optimization flag from -O3 to -Os and compiling _image.cpp manually (along with copying src/_image.cpp to src/ image.cpp and compiling that manually in the same way) allowed me to finish building matplotlib, but clearly an optimized agg image library is pretty important... (-O2 didn't work...) Anyone have any idea at all about this error? Or is just turning off - O3 for this file the best thing to do until Apple fixes the compiler bug? Does anyone who knows more about agg than I want to try to reduce this to a test case? Zach Pincus Postdoctoral Fellow Molecular, Cellular, and Developmental Biology Yale University - 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 -- Stephane Raynaud - This SF.net email is sponsored by: Microsoft Defy all challenges.
[Matplotlib-users] Transforms
I'm plotting some grid data using pcolor, and trying to get canvas pixel locations of data points using the ax.transData.xy_tup() method. I am saving these figures to PNG files using the default Agg backend. When I open these images up in Gimp and check the pixel locations, the X pixel locations are accurate, but the Y pixel locations I am getting from matplotlib seem to be exaggerated the further away from Y=0 I go. Am I using this method incorrectly? Could this be an artifact of the rendering to PNG? Thanks, Rich - 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] fill() function
I realize I was probably too wordy the first time I posted this: Does anyone know how to specify arbitrary colors to the fill() function? None of the following methods I tried seemed to work: ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array ([0.75,0.75,0.25,0.25,0.75]),'#FF') ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array ([0.75,0.75,0.25,0.25,0.75]),color='#FF') ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array ([0.75,0.75,0.25,0.25,0.75]),color=(1,0,0)) Thanks, Mike Hearne -- Michael Hearne [EMAIL PROTECTED] (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. -- - 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] Fwd: visualisation for utility usage sought
-- Forwarded message -- From: Christiaan Putter [EMAIL PROTECTED] Date: 14 Mar 2008 03:22 Subject: Re: [Matplotlib-users] visualisation for utility usage sought To: Chris Withers [EMAIL PROTECTED] Hi there, I'm having trouble understanding what it is you exactly want. You said you want to indicate that 'the monthly usage between September 1st and January 1st was, on average, the same as that between January 1st and February 1st.' So looking at the data you provided I'll assume the following: The measurement your taking is not in fact the utility usage for one month, but rather the sum of all usage over all prior months. And unfortunately it seems measurements aren't very regular (you working for the gov?). :-) no problem. Seeing that we're missing some data for the months in between measurements we'll have to interpolate. The simplest will be linear line segments between the known data points. (There are also some nice interpolation modules in scipy if you're looking for something smoother, ie. polynomials or cubic splines or something) Linear interpolation should look something like this. 2007/09/01 - 5000 2007/10/01 - 5750 2007/11/01 - 6500 2007/12/01 - 7250 2008/01/01 - 8000 2008/02/01 - 9000 Of course we're looking for the usage per month so we'll just calculate the difference in the aggregates. 2007/09/01 - 0 2007/10/01 - 750 2007/11/01 - 750 2007/12/01 - 750 2008/01/01 - 750 2008/02/01 - 1000 Obviously we don't have data prior to October so Augusts' usage ends up as zero. Now you can simply through that at matplotlib's plot() command and Bob's you're uncle. Using bar graphs for the usage per month is recommended, seeing that the measurements are so inconsistent to begin with plotting with continuous lines will only add to a false sense of accuracy. I'll recommend not using linear interpolation on this because the data will clearly be skewed. In our case there would have been a gradual increase in usage from September to January, and not the constant usage that linear interpolation gave us. Hope this helps. With matplotlib and scipy you're basically covered for all your scientific plotting needs. Have a nice day now. cputter On 12/03/2008, Chris Withers [EMAIL PROTECTED] wrote: Hi All, I hope this isn't considered off topic here, but this has been bugging me for a while and I reckon you guys may be able to help. To boot, I'd like to use matplotlib to make it happen, so I figure this list is fair game ;-) So, I have a series of measurements at points in time, eg: 2007/09/01 - 5000 2008/01/01 - 8000 2008/02/01 - 9000 ...and I'm looking to create some type of visualisation that indicates usage over time. The import point is that the gaps between point measurements are not constant, so a straight bar chart won't be right. The points also won't necessarilly be as convenient as those above, but hopefully they'll work as an example: What I'd expect to see would indicate that the monthly usage between September 1st and January 1st was, on average, the same as that between January 1st and February 1st. I'm having trouble expressing myself clearly, but hopefully I'm making some kind of sense. Any ideas very greatfully recieved! cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - 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] Point-specific colors with scatter
Hi there, I've got 4 time series that live in a 2-d space (imagine points at (1,1), (1,2),(2,1), and (2,2) that drift a little over time), and I'm using scatter() to show them. How can I plot so that each of the groups of points has the same colour? I've checked the docs and examples and can't seem to find quite what I'm looking for. A sample script or indication of where to look in the docs would be appreciated. Many thanks! Fred. -- Research is what I'm doing when I don't know what I'm doing. -- Wernher von Braun - 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