Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: obtaining the frequencies used in histogram


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: obtaining the frequencies used in histogram
Date   Mon, 8 Feb 2010 18:35:46 -0600

If you open the *.gph file in a text editor, the graph file contain
the program statements used to draw the graph, which in this case,
lists the starting point and the number of bins:

StataFileTM:00001:01000:LiveGPH:                       :
00003:00003:
*! classname: twowaygraph_g
*! family: twoway
*! command: twoway (histogram volume [], ytitle(`"Frequency"')
xtitle(`"Volume (thousands)"') legend(cols(1)) barwidth(-99)
plotregion(margin(b=0))   legend(nodraw) frequency start(4103) bin(15)
 )   (histogram volume [], frequency start(4103) bin(15)
recastas(scatter) msymbol(none) mlabel(_height) mlabposition(12)  )
||  ||
*! command_date:  8 Feb 2010
*! command_time: 18:20:12
*! datafile: C:\Program Files\Stata11\ado\base/s/sp500.dta
*! datafile_date: 22 Apr 2009 10:52
*! scheme: s2color
*! naturallywhite: 1
*! xsize: 5.5
*! ysize: 4
*! end
<BeginIte

Furthermore, on line 114 it list the bar widths:
.plotregion1.plot1.bar_size = 1280.353333333333

See also, Kit Baum's "An Introduction to Stata Programming," section
10.5 Extracting data from graph files' sersets

Scott


On Mon, Feb 8, 2010 at 6:09 PM, David Merriman <dmerrim@gmail.com> wrote:
> I have created some histograms in stata to be used in an article which
> is to be published.
> The person responsible for preparing the artwork for the publication
> has requested that I give her a
> table showing the raw frequencies used in the histogram.
> There are a number of histograms in the paper and   I am finding this
> quite difficult  for some of them.
>
> It is not a problem when I specified the bin, frequency and label
> options as below
>
> clear
> sysuse sp500
> **********************************
> * with bin option
> **************************************;
>  histogram volume, bin(15) frequency addlabel
> summarize volume
> gen min_vol=r(min)
> gen max_vol=r(max)
> generate volumecat = autocode(volume, 15, min_vol, max_vol)
> tab volumecat
>
> However, when I wrote the original paper I created the histograms
> without specifying the number of bins
> e.g.
>
> **********************************
> * without bin option
> **************************************;
>  histogram volume, frequency addlabel
>
>
> In these cases it hard to know the starting and ending points for the bins.
> I wonder if anyone has an idea how to do this?
> Thanks.
>
>
> --
> David Merriman
> dmerrim@gmail.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index