Re: [Matplotlib-users] contourf question
[EMAIL PROTECTED] wrote: Thanks again Eric, Your examples are exactly what I was after. Glad to hear it! My colleague was hypothesizing that there's probably a less-than instead of a less-than-or-equal somewhere, if it is a bug. That was part of it, but it was a little more subtle. I have tweaked the automatic level generation routine so that it now does what one might reasonably expect. Specifying levels explicitly is still better when you can do it; the number-of-levels method is really only for quick and dirty exploratory work, when you don't care too much which levels are chosen and you don't know in advance what the data interval will be. Eric - 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] pcolor or contour
hi i have been trying to use pcolor and/or contour to make a contor map or intensity map i want to do an intensity or contour map of an electric field i have an array (or list) of points [x,y] and for each point i have the respective value of the electric field (in another list) i have tried the examples in matplotlib but they are different because they use meshgrid and from the points calculated in the mesh get values and plot... in my case i want to plot directly...each poin (x,z) its magnitude(E_fiel_Mag) i do not think i need to use meshgrid any more how can i do my plot? below is my code...pls help me!!! #!/usr/bin/env python # This example demonstrates how to use a constraint polygon in # Delaunay triangulation. from scipy import* from pylab import* read_file= open ('W:/Serio/necfile.out','r') L =read_file.readlines() fieldlist =[] f = 0 for line in L: f=f+1 if 'NEAR ELECTRIC FIELDS'in line: rpoints = 3 phipoints = 3 tetapoints = 1 for line in range (f+3,f+4+rpoints*phipoints*tetapoints): fieldlist.append(L[line]) Ex = [];Ey = [];Ez = [] x1 =[];y1=[];z1=[] Exphase=[]; Eyphase=[]; Ezphase=[] for i in range(len(fieldlist)-1): splitlines= fieldlist[i].split() x1.append(float(splitlines[0])) #here we pick up the x,y,x coordinates of the points y1.append(float(splitlines[1])) #where the manitude has been calculated z1.append(float(splitlines[2])) Ex.append(float(splitlines[3])) #pick up the e-filed magnitudes Ey.append(float(splitlines[5])) #u append as floats instead os string for later calculations Ez.append(float(splitlines[7])) Exphase.append(float(splitlines[4])) # pick up the phases just in case they are needed Eyphase.append(float(splitlines[6])) Ezphase.append(float(splitlines[8])) read_file.close() # i want to see if i can calculate the magnitude of the electric field E_field_Mag = [] for i in range(len(Ex)): E_Magnitude = sqrt((Ex[i])**2 + (Ey[i])**2+(Ez[i])**2) E_field_Mag.append(E_Magnitude) #E_field_Mag = array(E_field_Mag) #y values are zero #X,Z = meshgrid(x1, z1) pcolor(x1,y1,E_field_Mag) - Mensaje original De: [EMAIL PROTECTED] [EMAIL PROTECTED] Para: matplotlib-users@lists.sourceforge.net Enviado: domingo, 30 de septiembre, 2007 12:53:11 Asunto: Matplotlib-users Digest, Vol 16, Issue 32 Send Matplotlib-users mailing list submissions to matplotlib-users@lists.sourceforge.net To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/matplotlib-users or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of Matplotlib-users digest... Today's Topics: 1. Re: NameError: global name '__loader__' is not defined (Eric Firing) 2. Re: plot cdf (Alan G Isaac) 3. Re: edgecolor with usetex=True,usedistiller='pdf' (Darren Dale) 4. Re: Problem with tick labels in scripts (John Hunter) 5. Using special characters (David Loyall) 6. Re: matplotlib - representation of nan values in2D (Dirk Zickermann) -- Message: 1 Date: Thu, 27 Sep 2007 14:46:13 -1000 From: Eric Firing [EMAIL PROTECTED] Subject: Re: [Matplotlib-users] NameError: global name '__loader__' is not defined To: Hal Huntley [EMAIL PROTECTED] Cc: matplotlib-users@lists.sourceforge.net Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hal Huntley wrote: Thanks to Eric Firing and Christopher Barker for input on trying to resolve the problem. Christopher said: %%% You might try just: easy_install numpy easy_install matplotlib. %%% I did that and now the problem moved and I get: === from pylab import * Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/pylab.py, line 1, in ? from matplotlib.pylab import * File /usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/pylab.py, line 222, in ? new_figure_manager, draw_if_interactive, show = pylab_setup() File /usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/__init__.py, line 24, in pylab_setup globals(),locals(),[backend_name]) File /usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py, line 10, in ? from matplotlib.backends.backend_gtk import gtk,
[Matplotlib-users] pcolor
I i have tree lists of values list x of 100... values list y of 100.. values list mag of 100.. values list x and y are coordiantes of points and list Mag is magnitude of something at that point how can i plot this quantities using pcolor from __future__ import division from matplotlib.patches import Patch from pylab import * def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2) # make these smaller to increase the resolution dx, dy = 0.5, 0.5 X = arange(-3.0, 3.0001, dx) Y = arange(-3.0, 3.0001, dy) Mag= X**2+Y**2 pcolor(X, Y, Mag, shading='flat') colorbar() axis([-3,3,-3,3]) savefig('pcolor_demo') show() ¡Sé un mejor besador! Comparte todo lo que sabes sobre besos. http://telemundo.yahoo.com/promos/mejorbesador.html- 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] Bug in boxplot ?
Hi, I just encountered something odd. I have (with import numpy as n and import pylab as pl) : x = n.arange(0, 2*n.pi, n.pi/30) z = n.array([n.cos(x), n.sin(x)]).T If I draw a boxplot on z : pl.boxplot(z) the values z are modified. Is this a feature or a bug ? Matthieu - 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
Re: [Matplotlib-users] pcolor
The short answer to your two messages is that pcolor and contour required gridded data in 2D arrays, and it looks like you are supplying 1D arrays. Look at the differences between what you have below and what is in the pcolor_demo that you started with. Meshgrid is generating 2D arrays for X and Y so that Z is also 2D. There are other ways of doing it, and for a Cartesian grid, X and Y don't actually have to be 2D--although I find that there is now a bug in svn such that 1D x and y don't work. I will fix that. But in any case, Z *must* be a 2D array. If the data you really want to plot are not already on a grid, then you will need to use a gridding routine, which is not included in mpl. Eric yadin Bocuma Rivas wrote: I i have tree lists of values list x of 100... values list y of 100.. values list mag of 100.. values list x and y are coordiantes of points and list Mag is magnitude of something at that point how can i plot this quantities using pcolor from __future__ import division from matplotlib.patches import Patch from pylab import * def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2) # make these smaller to increase the resolution dx, dy = 0.5, 0.5 X = arange(-3.0, 3.0001, dx) Y = arange(-3.0, 3.0001, dy) Mag= X**2+Y**2 pcolor(X, Y, Mag, shading='flat') colorbar() axis([-3,3,-3,3]) savefig('pcolor_demo') show() ¡Sé un mejor ambientalista! Encuentra consejos para cuidar el lugar donde vivimos en: http://telemundo.yahoo.com/promos/mejorambientalista.html - 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 - 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] multiple (2) y-axes
I wish to plot 3 lines on a single graph - each line requires a separate y scaling but shares a common x. The case for 2 such lines is handled by twinx as in the two_scales.py example. I have not found an example of 3 lines ( or greater). In the case of more than 2 scales the y axis scale would have to float, to the right or left of the y axes defined for the first 2 lines. Thanks for any help. ---Jim - 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
Re: [Matplotlib-users] multiple (2) y-axes
On 10/5/07, James Boyle [EMAIL PROTECTED] wrote: I wish to plot 3 lines on a single graph - each line requires a separate y scaling but shares a common x. The case for 2 such lines is handled by twinx as in the two_scales.py example. I have not found an example of 3 lines ( or greater). In the case of more than 2 scales the y axis scale would have to float, to the right or left of the y axes defined for the first 2 lines. This is on the wish list, but is currently unsupported. JDH - 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
Re: [Matplotlib-users] multiple (2) y-axes
On 10/5/07, James Boyle [EMAIL PROTECTED] wrote: I wish to plot 3 lines on a single graph - each line requires a separate y scaling but shares a common x. I have not found an example of 3 lines ( or greater). On Fri, 5 Oct 2007, John Hunter wrote: This is on the wish list, but is currently unsupported. If you just need an EPS or PDF, you can use PyX: http://pyx.sourceforge.net/gallery/graphs/manyaxes.html hth, Alan Isaac - 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
Re: [Matplotlib-users] multiple (2) y-axes
Here's some (incomplete) code snippets I used to place an extra x-axis below the normal one. I hope this helps. I agree that more axes can always be added at an arbitrary offset, although I did not try that. import numpy as N import matplotlib matplotlib.use(TkAgg) import pylab as PLT from matplotlib.font_manager import FontProperties # For setting legend font props. f1 = PLT.figure(1, figsize=(7.5,4.0)) ax1 = f1.add_axes([0.2, 0.25, 0.6, 0.6]) # This is normal axis PLT.hold(False) ax1.set_autoscale_on(False) # So that I can turn off autoscaling PLT.plot(lt, drift, '-', linewidth=3, label=legtext) # This axis is LT. Set the ticks manually. xticks = N.array([5.0, 8.0, 11.0, 14.0, 17.0, 20.0]) ax1.set_xticks(xticks.tolist()) ax1.set_autoscale_on(False) # So that I can turn off autoscaling # Now manually create the second axis (UT) slightly below PLT.hold(False) ax2 = f1.add_axes([0.2, 0.15, 0.6, 0.6], frameon=False) ax2.set_yticks([]) # Apply offset to get UT scale for second axis ax2.set_xlim([xticks[0]+offset, xticks[len(xticks)-1]+offset]) ax2.set_xticks((xticks+offset).tolist()) # Make tick lines invisible xtl = PLT.getp(ax2, 'xticklines') PLT.setp(xtl, 'visible', False) # Label the X ticks for first (LT) and second (UT) axes PLT.text(1.1, -0.1, 'LT', transform=ax1.transAxes) PLT.text(1.1, -0.25, 'UT', transform=ax1.transAxes) -Tony -- Tony Mannucci Supervisor, Ionospheric and Atmospheric Remote Sensing Group Mail-Stop 138-308, Tel (818) 354-1699 Jet Propulsion Laboratory, Fax (818) 393-5115 California Institute of Technology, Email [EMAIL PROTECTED] 4800 Oak Grove Drive, http://genesis.jpl.nasa.gov Pasadena, CA 91109 - 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