Re: finding out what Automatic was

*To*: mathgroup at smc.vnet.net*Subject*: [mg54242] Re: finding out what Automatic was*From*: Chris Chiasson <chris.chiasson at gmail.com>*Date*: Mon, 14 Feb 2005 21:50:35 -0500 (EST)*References*: <200502140317.WAA14113@smc.vnet.net>*Reply-to*: Chris Chiasson <chris.chiasson at gmail.com>*Sender*: owner-wri-mathgroup at wolfram.com

Your question seems like a good one to me, probably because I don't know the answer :] However, given that the category intervalas by the histogram command are in the form of rectangles, one could just extract them. The first three lines of the code that follow are directly from the help file entry that contains the Histogram function description. Please accept my apologies if you already understand the concepts involved in this code. This code may be evaluated one line at a time for clarity. Needs["Statistics`NormalDistribution`"] normdata=RandomArray[NormalDistribution[],100] Needs["Graphics`Graphics`"] hist=Histogram[normdata] (*hist is a graphics object - the next line shows the internal structure of hist*) hist//FullForm (*notice everything fis the form h[argument1,argument2,etc], which can be thought of as functions*) {3,2,1}//FullForm List[3,2,1]//FullForm f[x,y,z]//FullForm (*notice the similarity between lists and everyday functions that have not evaluated their parameters*) (*There are commands for extracting objects at different "depths" of nested functions.*) (*the relevant objects we would like to extract are the rectangle functions, which are located on level 4 of the hist graphics object*) Level[hist,{4}] (*note how the 4 is inisde brackets, just passing a plain 4 will give everything down to that level, not just the level itself*) (*how many levels of nested functions are there in this graphics object*) Depth[hist] Level[hist,Depth[hist]] (*most commands have a parameter allowing one to specify the level at which one wants to operate, rather than having to wrap the arguments in Level functions*) (*the parameter we need to supply is the last argument in the case statement*) (*why would we need to use a case statement? well -- we need to extract the rectangle functions and they happen to fit a pattern.case statements extract objects that fit particular patterns from other objects (heh,at least in mathematica:])*) (*so we first define the pattern*) Set[thepattern, Rectangle[List[Pattern[xmin,Blank[]],Pattern[ymin,Blank[]]], List[Pattern[xmax,Blank[]],Pattern[ymax,Blank[]]]]] (*note this could also be written thepattern= Rectangle[{xmin_,ymin_},{xmax_,ymax_}]*) (*since we don't really care what level the rectangle functions are at inside hist,,just supply the Depth[hist] for the level argument... this will have the effect of searching for the rectangle pattern at all levels*) Set[thecases,Cases[hist,thepattern,Depth[hist]]] (*note this could also be written Cases[hist,thepattern,Depth[hist]]*) Set[thesplits,ReplaceAll[thecases,Rule[thepattern,List[xmin,xmax]]]] thesplits//FullForm (*the above command gives you the list of bin splits-- it could also be written as thesplits=thecases/.thepattern\[Rule]{xmin,xmax}*) Regards, On Sun, 13 Feb 2005 22:17:16 -0500 (EST), Curt Fischer <tentrillion at gmail.nospam.com> wrote: > Dear Group: > > How do you find out what value Mathematica has picked for an option set > to "Automatic", especially when making graphs? > > For example, I want to access the frequency data for a Histogram[] I > made from a list of 50000 integers. How do I figure out which bin sizes > Histogram[] picked if I don't explicitly specify the bin sizes? > > Thanks. > > -- > Curt Fischer > > -- Chris Chiasson Kettering University Mechanical Engineering Graduate Student 1 810 265 3161

**Follow-Ups**:**Re: Re: finding out what Automatic was***From:*DrBob <drbob@bigfoot.com>

**References**:**finding out what Automatic was***From:*Curt Fischer <tentrillion@gmail.NOSPAM.com>