From: Istvan S. <szapudi@IfA.Hawaii.Edu> - 2004-12-24 03:49:31
|
Hi All, I am fairly new to matplotlib, and I am impressed with its capabilities. I have trouble plotting loglog plots with errorbars. I have the following, program, a slightly modified version of one given earlier by JDH on 9-28-2004 in this mailing list: ------------------------------------------------------ from matplotlib.matlab import * import random random.seed(13) ## with 10 elements it works ## but with 11 elements it crashes x = arange(1.0,12) y = array(map(lambda s:1e6*random.random()+1e5+1,x)) err = array(map(lambda s:1e5*random.random(),x)) print x,y,err print y-err ax = gca() errorbar(x,y,err,fmt='o') ##plot(x,y) ax.set_yscale("log") ax.set_xscale("log") show() ------------------------------------------------------- The weird thing is that it runs with 10 points, but not with 11 or more. I guess the random generator happens to generate a configuration which breaks the routine. I did check that everything is positive (BTW, it would be great to have a version which simply ignores negative/0 values), the last point does not seem special, I can't figure out what's going on. I run matplotlib 0.64 (sorry I did not convert to pylab yet), on python 2.3.4/gcc 3.3.1 under a fairly new cygwin installation in WinXP SP2. any clue anybody? thanks, I. ps. Merry Xmas/Happy Holidays to everybody! ----------------------------------------------------------- Istvan Szapudi Institute for Astronomy University of Hawaii 2680 Woodlawn Drive Honolulu, HI 96822 USA Tel. : (808) 956-6196 (also x9844 in Febr/March) Fax : (808) 956-9590 Email: sz...@if... WWW : http://www.ifa.hawaii.edu/~szapudi/istvan.html ----------------------------------------------------------- |