Re: [Matplotlib-users] unpacking multiple files
Hi Bala, On Tuesday 31 March 2009 17:00:59 Bala subramanian wrote: Friends, 1) I want to make a plot of multiple lines. I want to make something like ./multiplot.py 1.dat 2.dat 3.dat .. n.dat All files contain two columns and are of same length. plotfile() and load() do not take list of file but one file name only. In such cases, I want to unpack the x,y values in 1.dat,2.dat n.dat and plot it at a stretch. What is the best way to do it. Any suggestion would be highly helpful. you may just run through the list sys.argv like for filename in sys.argv: plotlfile(filename, ...) 2) How can i fix the default values, like first line should be black, second line in red , third in blue. define your own favourite color-list like my_colors = ['black', 'red', 'blue'] and afterwards circle through this like: for index, filename in enumerate(sys.argv): plotlfile(filename, ..., color=my_colors[index]) regards Matthias Thanks bala -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Legend for smoothed lines
I want to plot smooth line between data points (Excel like) and I can do it with with 2 lines: a.. Original data points as circles, for instance: plot(x, y, 'bo') b.. Spline of these points as line: plot(xnew, ynew, 'b-') The only problem with this is the legend - I get either 'o' or '---' but not the required 'o-o'. Thanks for any suggestions, *** This e-mail message may contain confidential,and privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imread() and PNGs
Eric Firing schrieb: Gregor Thalhammer wrote: Tobias Wood [...] [...] I also noticed you used C++ constructs in your code. I think this is not recommended. Gregor, Would you elaborate, please, to satisfy my curiosity? The original file is C++, so use of C++ constructs in the patch would seem natural. Thank you. Eric You are right. I was assuming the original file is C. Sorry for this stupid comment. Gregor -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Scalar on a Circular Grid
Hello, So maybe a couple of images can help. Using the code #!/usr/bin/env python See pcolor_demo2 for a much faster way of generating pcolor plots from __future__ import division from pylab import * def func3(x,y): return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2) def func4(x,y): theta=arcsin(y) return cos(theta) # make these smaller to increase the resolution dx, dy = 0.05, 0.05 x = arange(-1.0, 1.0, dx) y = arange(-1.0, 1.0, dy) X,Y = meshgrid(x, y) Z = func4(X, Y) print Z is, , Z ax = subplot(111) im = imshow(Z, cmap=cm.jet) #im.set_interpolation('nearest') #im.set_interpolation('bicubic') im.set_interpolation('bilinear') #ax.set_image_extent(-3, 3, -3, 3) show() I can get the attached image.png, but what I am really after is image2.png (the same quantity plotted on a circular domain!). How can I achieve that (without using scissors on an existing image?). This is what I meant from start. Cheers Lorenzo 2009/4/3 Jae-Joon Lee lee.j.j...@gmail.com: I'm afraid that I'm still confused and there seems to be not much thing I can help.. You're considering a circle, but you already have your function in a cartesian coordinate. I'm not sure why you can't just plot in a cartesian coordinate? (in other words, what is wrong with your original script?) There is an set_image_extent call in your original script (although commented out). Maybe what you're trying to do is simply im = imshow(Z, cmap=cm.jet, extent=(-3, 3, -3, 3)) I'm not sure it would be relevant, but if you have your function or data in (r, theta) coordinate, one simple way is just to use the polar axes with pcolormesh method. n_theta, n_r = 100, 50 theta = np.linspace(0, 2*np.pi, n_theta+1) r = np.linspace(0., 1., n_r + 1) data = np.arange(0., n_theta*n_r).reshape(n_r, n_theta) ax=subplot(1,1,1, projection=polar, aspect=1.) ax.pcolormesh(theta, r, data) -JJ -- Life is what happens to you while you're busy making other plans. attachment: image.pngattachment: image2.png-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ylabel not visible if yscale ~1E-6
Hi, I found a minor bug, feel free to ignore it :) . If the vertical scale of a plot has numbers ~1E-6 the ylabel won't be visible. Example script: #--- import matplotlib.pyplot as plt import numpy as np x = np.arange(-10.0,10.0,0.1) plt.plot(x,1E-6*np.sin(x)) plt.ylabel(Y Label) plt.show() #--- The workaround is of course simple, just adjust figure.subplot.left. Ubuntu 8.10, matplotlib svn (rev. 7032). JLS -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] making the space between ticks
Chaitanya Krishna icym...@gmail.com writes: That is, when I use pylab.ylabel(r'$V [A^{3}]$') I don't get any space in between V and [. Like TeX, matplotlib ignores spaces in math mode and uses spacing derived from the usual roles of the symbols. You need to use an explicit command to add space. I also tried using the math mode spacing for Latex, So, if I try to do pylab.ylabel(r'$V\;[A^{3}]$'), I only get V and not even A^3. On the current trunk, and on the v0_98_5 maintenance branch, that works fine. At least the following spacing commands seem to work: r'$a\ b$', r'$a\,b$', r'$a\;b$', r'$a\!b$' (negative space) and r'$a\quad b$' work. Perhaps you can update to a newer version of matplotlib? -- Jouni K. Seppänen http://www.iki.fi/jks -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] making the space between ticks
On Monday 06 April 2009 20:15:47 Jouni K. Seppänen wrote: Chaitanya Krishna icym...@gmail.com writes: That is, when I use pylab.ylabel(r'$V [A^{3}]$') I don't get any space in between V and [. Like TeX, matplotlib ignores spaces in math mode and uses spacing derived from the usual roles of the symbols. You need to use an explicit command to add space. I also tried using the math mode spacing for Latex, So, if I try to do pylab.ylabel(r'$V\;[A^{3}]$'), I only get V and not even A^3. On the current trunk, and on the v0_98_5 maintenance branch, that works fine. At least the following spacing commands seem to work: r'$a\ b$', r'$a\,b$', r'$a\;b$', r'$a\!b$' (negative space) and r'$a\quad b$' work. Perhaps you can update to a newer version of matplotlib? It is also possible to mix math mode and non-math mode. ylabel(r'$V$ [\AA$^3$]') (also note that units by convention are not italic...) Best regards Troels Kofoed Jacobsen -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] colorbar with 2 different scales
Is it possible to create a colorbar with different scales on each side? Example: a temperature colorbar with celcius values on the left side and farenheit values on the right side. If so, how could this be done? Please help, Thanks, P.Romero -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbar with 2 different scales
P.Romero wrote: Is it possible to create a colorbar with different scales on each side? Example: a temperature colorbar with celcius values on the left side and farenheit values on the right side. If so, how could this be done? A colorbar is just an axes object with some customization of the ticks and labels, and with a pcolor plot inside. You could get your second scale using a technique similar to the twinx and twiny Axes methods; you can then use set_xlim or set_ylim so that the Fahrenheit range on the new axes matches the Celcius range on the old one. To get started, look at the source for the twinx/twiny methods. Eric Please help, Thanks, P.Romero -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-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: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with basemap my data arrays, gap around plot edge
P.Romero wrote: Jeff, I've attached a test script and my data file. Unfortunately, the method that Im using to create the data set isn't very portable (the data is being imported from an external program), so sending my .npz file is the best I can do. The gaps are about 5 pixels, and create an offset from where the contours end to where the basemap hits the edge of the plot. Please let me know if there's something in my data set that could be causing this, or if its an issue with basemap. Thanks, P.Romero Pablo: The extend of your map projection region is m.ymin, m.ymax = 0.0 1812318.63167 whereas Y.min(), Y.max() = -28762.6317985 1780259.69866. The reason you get the gap along the top edge is that the data doesn't extend all the way to the northern boundary of the map region. Just shrink your map region a little bit and it will go away. -Jeff -Original Message- From: Jeff Whitaker [mailto:jsw...@fastmail.fm] Sent: 2009-04-06 6:13 AM To: P.Romero Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] problem with basemap my data arrays, gap around plot edge P.Romero wrote: Hi, Im having a problem with contourf basemap; theres a fairly wide gap showing up around the topleft edges of my plot. Im trying to do the following: Import numpy as np Z=my_data( .) m=basemap( . ) X,Y=m(*np.meshgrid(Z.lon,Z.lat)) Znp=Z.filled cs=m.contourf(X,Y,Znp) using this method, Im experiencing a strange gap around the lefttop edges of the plot. It seems as if the contour data is not aligning correctly with the basemap, or is somehow 'falling short' of filling in the entire area. Ive used this same method to plot other contour plots and have never experienced this type of gap (using the same version of basemap/matplotlib/numpy/etc.). Im not sure if there's something wrong with the way Im creating my data, or if this is a problem with basemap. In either case, can someone please provide me with some help figuring out why that gap is appearing? Ive attached an npz file with my 3 arrays: X,Y,Znp. Ive also attached a png image of my output, where the gap is clearly evident around the lefttop edges. Thanks, P.Romero Pablo: Please include a working example that creates your example plot. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot() in a loop vs multiple curves with a single plot()
A B python6...@gmail.com writes: I have the following code and am wondering whether there is a more efficient way to plot multiple curves. Maybe somehow accumulating the data into a single variable, then calling plot once ... Thanks for any ideas. for ofile in files: d = mlab.csv2rec(ofile, names = ['date','field']) ax.plot(d['date'], d['field']) You can give multiple x,y pairs to plot, so perhaps something like data = [mlab.csv2rec(f, names=['date','field']) for f in files] data = [[x['date'],x['field']] for x in data] ax.plot(*np.concatenate(data)) would work. But I don't know if it's really any more efficient. For large plots, you may want to take a look at collections: http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.LineCollection -- Jouni K. Seppänen http://www.iki.fi/jks -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] New/Fixed Simple Animation Example
In regards to my previous example, the lambda function magic is unnecessary, instead of: gobject.idle_add(lambda iter=animate(): iter.next()) It is simply adequate to do: gobject.idle_add(animate().next) Which is much simpler. My apologies for over coding the solution. -- Nathaniel -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2 axes bar chart -- malformed header from script. Bad headerRe: colorbar with 2 different scales
Hi, P.Romero, Please let me know if you get this working. I am trying to do the same type of 2 axes bar chart. but I got error message. I am using regular bar (). the following is the email i sent a week ago. Eric, I did use the twinx(), but it gave errors. thanks in advance. Hi, everyone, I am a matplotlib beginner. I am trying to do a chart with 2 y axes using twinx() I keep getting error message malformed header from script. Bad header= is masked in one or more l: test.cgi when I do two bar charts on two axes. if I do one bar chart and one line chart, I wouldnt get the error. if I refresh the web page, the chart would show up. the following is my code. ... ax = self.fig.add_axes( self.rectMain, axisbg=self.axesBG) ticks = self.setTickInterval( 10, 0, buybackDataobj.sharesMax) ind = na.array(range(len(buybackDataobj.quarters))) majorFormatter = FormatStrFormatter('%2.1f') ax.yaxis.set_major_locator(MultipleLocator( ticks ) ) ax.yaxis.set_major_formatter(majorFormatter) bar(ind, buybackDataobj.shares, self.barwidth, color=self.draw.color['DarkGreen'] ) t = arange(0, float(buybackDataobj.sharesMax), ticks ) ax.set_ylim(0, buybackDataobj.sharesMax * 1.1) ax.set_xlim(0, ind[-1] + self.barwidth*2) ax.set_ylabel(Value Bought + buybackDataobj.scale, fontsize = self.fontsize ) ax.set_xticks(ind + self.barwidth) ax.set_xticklabels( buybackDataobj.quarters, fontsize = self.fontsize) setp( ax.get_xticklabels(), rotation = self.rotation, horizontalalignment='center', family= 'sans-serif', fontsize = self.xaxisfs ) if buybackDataobj.charttype == 'sells': ax2 = twinx() #ax2.plot(ind + self.barwidth/2, buybackDataobj.sells, ls='-', marker ='.', ms=11, c='#FF3300') // I wouldnt get the error message if I do this plot bar(ind + self.barwidth, buybackDataobj.sells, self.barwidth, color='#FF3300' ) // malformed header from script. Bad header=is masked in one or more l: test.cgi ax2.set_xticklabels(buybackDataobj.quarters, visible=False ) ax2.set_ylim(buybackDataobj.sellsMin * 0.75, buybackDataobj.sellsMax * 1.1) ax2.set_ylabel(Insider Selling $ + buybackDataobj.sellsScale, verticalalignment='center', fontsize = self.fontsize) setp( ax2.get_yticklabels(), rotation = 0, horizontalalignment='left', family='sans-serif', fontsize=self.fontsize ) . On Mon, Apr 6, 2009 at 3:44 PM, Eric Firing efir...@hawaii.edu wrote: P.Romero wrote: Is it possible to create a colorbar with different scales on each side? Example: a temperature colorbar with celcius values on the left side and farenheit values on the right side. If so, how could this be done? A colorbar is just an axes object with some customization of the ticks and labels, and with a pcolor plot inside. You could get your second scale using a technique similar to the twinx and twiny Axes methods; you can then use set_xlim or set_ylim so that the Fahrenheit range on the new axes matches the Celcius range on the old one. To get started, look at the source for the twinx/twiny methods. Eric Please help, Thanks, P.Romero -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-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: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-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: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 axes bar chart -- malformed header from script. Bad headerRe: colorbar with 2 different scales
j bai wrote: Hi, P.Romero, Please let me know if you get this working. I am trying to do the same type of 2 axes bar chart. but I got error message. I am using regular bar (). the following is the email i sent a week ago. Eric, I did use the twinx(), but it gave errors. thanks in advance. Hi, everyone, I am a matplotlib beginner. I am trying to do a chart with 2 y axes using twinx() I keep getting error message malformed header from script. Bad header=is masked in one or more l: test.cgi when I do two bar charts on two axes. if I do one bar chart and one line chart, I wouldnt get the error. if I refresh the web page, the chart would show up. the following is my code. ... ax = self.fig.add_axes( self.rectMain, axisbg=self.axesBG) ticks = self.setTickInterval( 10, 0, buybackDataobj.sharesMax) ind = na.array(range(len( buybackDataobj.quarters))) majorFormatter = FormatStrFormatter('%2.1f') ax.yaxis.set_major_locator(MultipleLocator( ticks ) ) ax.yaxis.set_major_formatter(majorFormatter) bar(ind, buybackDataobj.shares, self.barwidth, color=self.draw.color['DarkGreen'] ) Try making that ax.bar(...) t = arange(0, float(buybackDataobj.sharesMax), ticks ) ax.set_ylim(0, buybackDataobj.sharesMax * 1.1) ax.set_xlim(0, ind[-1] + self.barwidth*2) ax.set_ylabel(Value Bought + buybackDataobj.scale, fontsize = self.fontsize ) ax.set_xticks(ind + self.barwidth) ax.set_xticklabels( buybackDataobj.quarters, fontsize = self.fontsize) setp( ax.get_xticklabels(), rotation = self.rotation, horizontalalignment='center', family= 'sans-serif', fontsize = self.xaxisfs ) if buybackDataobj.charttype == 'sells': ax2 = twinx() #ax2.plot(ind + self.barwidth/2, buybackDataobj.sells, ls='-', marker ='.', ms=11, c='#FF3300') // I wouldnt get the error message if I do this plot bar(ind + self.barwidth, buybackDataobj.sells, self.barwidth, color='#FF3300' ) // malformed header from script. Bad header=is masked in one or more l: test.cgi And make that one ax2.bar(...). It sounds like you have a combined mpl and cgi problem here; maybe an exception in mpl is triggering a cgi error. malformed header from script is not coming from mpl. is masked in one or more probably is, but you need to see the whole traceback to find out what the problem is. So as a matter of strategy, separate the mpl from the cgi; make sure your script runs without error in standalone mode. Stick to purely or mostly OO style. You probably want to start with something like import matplotlib matplotlib.use(agg) import pyplot as plt # e.g. if you want to use fig = plt.figure() This makes sure you are using a non-interactive backend. See http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server Eric ax2.set_xticklabels(buybackDataobj.quarters, visible=False ) ax2.set_ylim(buybackDataobj.sellsMin * 0.75, buybackDataobj.sellsMax * 1.1) ax2.set_ylabel(Insider Selling $ + buybackDataobj.sellsScale, verticalalignment='center', fontsize = self.fontsize) setp( ax2.get_yticklabels(), rotation = 0, horizontalalignment='left', family='sans-serif', fontsize=self.fontsize ) . On Mon, Apr 6, 2009 at 3:44 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: P.Romero wrote: Is it possible to create a colorbar with different scales on each side? Example: a temperature colorbar with celcius values on the left side and farenheit values on the right side. If so, how could this be done? A colorbar is just an axes object with some customization of the ticks and labels, and with a pcolor plot inside. You could get your second scale using a technique similar to the twinx and twiny Axes methods; you can then use set_xlim or set_ylim so that the Fahrenheit range on the new axes matches the Celcius range on the old one. To get started, look at the source for the twinx/twiny methods. Eric Please help, Thanks, P.Romero -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com
[Matplotlib-users] Installing Matplotlib
Hi, sorry to bother you. This may be a trivial question for experienced Matplotlib users. I am trying to install Matplotlib under Windows XP but with no success. I am not familiar with Python or any of the other packages and I've never used Matplotlib before. I followed the instructions in the Matplotlib User's Manual and I have installed in the following sequence 1) Python(x,y)-2.1.12, 2) python-2.6.1.msi and 3) numpy-1.3.0-win32-superpack-python2.6.exe. Can anyone advise me on what to do next? Thanks, Constantine -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Installing Matplotlib
A quick but not necessarily accurate answer: Don't use Python 2.6. Use Python 2.5. I don't think matplotlib has been 'certified' for 2.6 yet. I suggest (1) uninstall Python 2.6 and numpy for 2.6. (2) Install Python 2.5 and numpy for 2.5 (3) Install matplotlib for 2.5 Constantine cksm...@gmail.com 07/04/2009 10:19 AM To matplotlib-users@lists.sourceforge.net cc Subject [Matplotlib-users] Installing Matplotlib Hi, sorry to bother you. This may be a trivial question for experienced Matplotlib users. I am trying to install Matplotlib under Windows XP but with no success. I am not familiar with Python or any of the other packages and I've never used Matplotlib before. I followed the instructions in the Matplotlib User's Manual and I have installed in the following sequence 1) Python(x,y)-2.1.12, 2) python-2.6.1.msi and 3) numpy-1.3.0-win32-superpack-python2.6.exe. Can anyone advise me on what to do next? Thanks, Constantine __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users UNITED GROUP This email message is the property of United Group. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, you may not disclose, copy or distribute this email, nor take or omit to take any action in reliance on it. United Group accepts no liability for any damage caused by this email or any attachments due to viruses, interference, interception, corruption or unauthorised access. If you have received this email in error, please notify United Group immediately by email to the sender's email address and delete this document.-- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Linear regression question
I'm new to matplotlib and am really enjoying using it. I'm confused by something though: If I plot the following linear regression it works as expected. from pylab import * x = range(10) y = range(10) m,b = polyfit(x, y, 1) plot(x, y, 'yo', x, m*x+b, '--k') show() The following code produces an error though (only the length of the vectors have been changed): from pylab import * x = range(11) y = range(11) m,b = polyfit(x, y, 1) plot(x, y, 'yo', x, m*x+b, '--k') show() I'm using: python 2.5 matplotlib 0.98.5.2 numpy 1.3.0 Below is the error message: Traceback (most recent call last): File stdin, line 8, in module File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 2096, in plot ret = gca().plot(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 3277, in plot for line in self._get_lines(*args, **kwargs): File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 401, in _grab_next_args for seg in self._plot_3_args(remaining, **kwargs): File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 340, in _plot_3_args x, y, multicol = self._xy_from_xy(x, y) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 228, in _xy_from_xy assert nrx == nry, 'Dimensions of x and y are incompatible' AssertionError: Dimensions of x and y are incompatible Unbunt Hardy 8.04 Thanks, Juls -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Linear regression question
Juls Night wrote: I'm new to matplotlib and am really enjoying using it. I'm confused by something though: [...] The following code produces an error though (only the length of the vectors have been changed): from pylab import * x = range(11) y = range(11) m,b = polyfit(x, y, 1) plot(x, y, 'yo', x, m*x+b, '--k') The problem is that x is a list, not an array, and m*x yields an empty array: In [17]:m*x Out[17]:[] In [18]:m Out[18]:0.99978 In [19]:x Out[19]:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Solution: use x = arange(11) y = arange(11) Eric -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Custom made colormaps
Gökhan SEVER wrote: Hello, I am trying convert a plot written in IDL to Python using matplotlib. So far, I have managed to show the image on the screen equivalent to its IDL output. The only problem that I could not figure out matching the colormaps between them. Please see the results on this png image: http://img515.imageshack.us/img515/3951/colormaps.png The top plot and the associated colorbar is from IDL, and the other plot is using matplotlib's imshow(). I don't know how to show my lowest values in the plot as white. I would be please if someone gives some insight into this issue. See http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html and in particular the use of set_under(). Eric Thank you all. Gökhan -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Linear regression question
Eric Firing efir...@... writes: Solution: use x = arange(11) y = arange(11) Eric Thanks Eric, That has solved my problem! Best, Juls -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users