On Sat, Nov 28, 2009 at 1:01 AM, <josef.p...@gmail.com> wrote: > On Fri, Nov 27, 2009 at 9:44 PM, Wayne Watson > <sierra_mtnv...@sbcglobal.net> wrote: > > Joseph, > > That got it by the fig problem but there is yet another one. value is > > not defined on the very long line: > > range = ... > > Wayne > > (values is the data array, ... no idea about > scientificstat.standardDeviation) > > Sebastian's example is only part of a larger script that defines many > of the variables and functions that are used. > > If you are not yet familiar with these examples, maybe you look at the > self contained examples in the matplotlib docs. At least that's what I > do when I only have a rough idea about what graph I want to do but > don't know how to do it with matplotlib. I usually just copy a likely > looking candidate and change it until it (almost) produces what I > want. > For example look at histogram examples in > > http://matplotlib.sourceforge.net/examples/index.html > > Josef > > > > josef.p...@gmail.com wrote: > >> On Fri, Nov 27, 2009 at 9:05 PM, Sebastian <seb...@gmail.com> wrote: > >> > >> ... > >> you need to create a figure, before you can use it > >> > >> fig = pylab.figure() > >> > >> Josef > >> > >> > >>>> ax = fig.add_subplot(1,1,1) > >>>> pylab.title(r'\Large BCG NO radio distribution $ \rm{TITLE}$') > >>>> n, bins, patches = pylab.hist(values, bins=math.sqrt(len(values)), > >>>> > >>>> > range=(numpy.mean(values)-3*scientificstat.standardDeviation(values),numpy.mean(values)+3*scientificstat.standardDeviation(values)), > >>>> normed=1, facecolor='y', alpha=0.5) > >>>> ax.set_xlabel(r'\Large$ \rm{values}$') > >>>> ax.set_ylabel(r'\Large Delatavalue/Value') > >>>> > >>>> > >>>> > gausx=numpy.arange(numpy.mean(Value)-3*scientificstat.standardDeviation(Value),numpy.mean(Value)+3*scientificstat.standardDeviation(bpty_plt),0.1) > >>>> > >>>> > gaus=normpdf(gausx,numpy.mean(Value),scientificstat.standardDeviation(Value)) > >>>> pylab.plot(gausx,gaus, color='red', lw=2) > >>>> ax.set_xlim(-1.5, 1.5) > >>>> ax.grid(True) > >>>> > >>>> Sebastian wrote: > >>>> > >>>>> Did you try using the parameter range? > >>>>> I do something like this. > >>>>> regards > >>>>> > >>>>> ax = fig.add_subplot(1,1,1) > >>>>> pylab.title(r'\Large BCG NO radio distribution $ \rm{TITLE}$') > >>>>> n, bins, patches = pylab.hist(values, > bins=math.sqrt(len(values)), > >>>>> > >>>>> > range=(numpy.mean(values)-3*scientificstat.standardDeviation(values),numpy.mean(values)+3*scientificstat.standardDeviation(values)), > >>>>> normed=1, facecolor='y', alpha=0.5) > >>>>> ax.set_xlabel(r'\Large$ \rm{values}$') > >>>>> ax.set_ylabel(r'\Large Delatavalue/Value') > >>>>> > >>>>> > >>>>> > gausx=numpy.arange(numpy.mean(Value)-3*scientificstat.standardDeviation(Value),numpy.mean(Value)+3*scientificstat.standardDeviation(bpty_plt),0.1) > >>>>> > >>>>> > gaus=normpdf(gausx,numpy.mean(Value),scientificstat.standardDeviation(Value)) > >>>>> pylab.plot(gausx,gaus, color='red', lw=2) > >>>>> ax.set_xlim(-1.5, 1.5) > >>>>> ax.grid(True) > >>>>> > >>>>> > >>>>> On Fri, Nov 27, 2009 at 4:38 PM, Christopher Barker > >>>>> <chris.bar...@noaa.gov <mailto:chris.bar...@noaa.gov>> wrote: > >>>>> > >>>>> josef.p...@gmail.com <mailto:josef.p...@gmail.com> wrote: > >>>>> > On Fri, Nov 27, 2009 at 12:57 PM, Skipper Seabold > >>>>> <jsseab...@gmail.com <mailto:jsseab...@gmail.com>> wrote: > >>>>> > >>>>> >> This kind of info might be useful to other newcomers > >>>>> >> somewhere... <http://www.scipy.org/History_of_SciPy>? > Thoughts > >>>>> on > >>>>> >> posting this on the wiki here? > >>>>> > > >>>>> > I also agree. It will improve with the newly redesigned website > >>>>> for scipy.org <http://scipy.org> > >>>>> > However, I cannot find the link right now for the development > >>>>> version of > >>>>> > the new website. > >>>>> > >>>>> Feel free to crib whatever you want from my post for that -- or > >>>>> suggest > >>>>> a place for me to put it, and I'll do it. I'm just not sure where > it > >>>>> should go at this point. > >>>>> > >>>>> -Chris > >>>>> > >>>>> > >>>>> -- > >>>>> Christopher Barker, Ph.D. > >>>>> Oceanographer > >>>>> > >>>>> Emergency Response Division > >>>>> NOAA/NOS/OR&R (206) 526-6959 voice > >>>>> 7600 Sand Point Way NE (206) 526-6329 fax > >>>>> Seattle, WA 98115 (206) 526-6317 main reception > >>>>> > >>>>> chris.bar...@noaa.gov <mailto:chris.bar...@noaa.gov> > >>>>> _______________________________________________ > >>>>> NumPy-Discussion mailing list > >>>>> NumPy-Discussion@scipy.org <mailto:NumPy-Discussion@scipy.org> > >>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion > >>>>> > >>>>> > >>>>> > ------------------------------------------------------------------------ > >>>>> > >>>>> _______________________________________________ > >>>>> NumPy-Discussion mailing list > >>>>> NumPy-Discussion@scipy.org > >>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion > >>>>> > >>>>> > >>>> -- > >>>> Wayne Watson (Watson Adventures, Prop., Nevada City, CA) > >>>> > >>>> (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) > >>>> Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet > >>>> > >>>> 350 350 350 350 350 350 350 350 350 350 > >>>> Make the number famous. See 350.org > >>>> The major event has passed, but keep the number alive. > >>>> > >>>> Web Page: <www.speckledwithstars.net/> > >>>> > >>>> _______________________________________________ > >>>> NumPy-Discussion mailing list > >>>> NumPy-Discussion@scipy.org > >>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion > >>>> > >>> _______________________________________________ > >>> NumPy-Discussion mailing list > >>> NumPy-Discussion@scipy.org > >>> http://mail.scipy.org/mailman/listinfo/numpy-discussion > >>> > >>> > >>> > >> _______________________________________________ > >> NumPy-Discussion mailing list > >> NumPy-Discussion@scipy.org > >> http://mail.scipy.org/mailman/listinfo/numpy-discussion > >> > >> > > > > -- > > Wayne Watson (Watson Adventures, Prop., Nevada City, CA) > > > > (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) > > Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet > > > > 350 350 350 350 350 350 350 350 350 350 > > Make the number famous. See 350.org > > The major event has passed, but keep the number alive. > > > > Web Page: <www.speckledwithstars.net/> > > > > _______________________________________________ > > NumPy-Discussion mailing list > > NumPy-Discussion@scipy.org > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
Chris I',m using the package Scientific.Stats to calculate the standard deviation. I believe it is from here: http://dirac.cnrs-orleans.fr/plone/software/scientificpython/ I use the Scientific.Stats package for the standard deviation calculation because back when I wrote the code I realized that numpy's standard deviation seems to assume that you have all the distribution (the parent population),while I think the Scientific.Stats is more accurate for smaller samples. But maybe there is an equivalent numpy standard deviation. If I recall OK the difference is an (n-1) instead of an (n) in the formula. For larger samples both the numpy and the Scientific.Stats standard deviation shouldn't be too different . So I use the range to specify the values to bin over. It seems you might want your range parameter to be different. I'm choosing the range to be +/- 3-sigma, and that way ignore values that are too extreme so my bins a more concentrated about the distribution. OK so I also have to add the following import line in the code, too: import Scientific.Statistics as scientificstat Sebas
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion