# Re: st: Graphs and number of observations

 From "Austin Nichols" <[email protected]> To [email protected] Subject Re: st: Graphs and number of observations Date Thu, 10 Apr 2008 13:32:38 -0400

```Herve STOLOWY <[email protected]>:
I'm not sure what you're looking for--do you mean display the count of
obs on the relevant part of the graph? It would help if you gave an
example using the auto data, like so:

sysuse auto, clear
histogram mpg if mpg>25 & mpg<40, by(for) bin(20) name(wo, replace)
count if mpg>25 & mpg<40 & for==0
local n0=r(N)
count if mpg>25 & mpg<40 & for==1
local n1=r(N)
la def `:val label for' 0 `"`:label (for) 0': `n0' obs."', modify
la def `:val label for' 1 `"`:label (for) 1': `n1' obs."', modify
histogram mpg if mpg>25 & mpg<40, by(for, title(With #Obs.)) bin(20)

On Thu, Apr 10, 2008 at 1:17 PM, Herve STOLOWY <[email protected]> wrote:
> Dear Statalisters:
>
> I am starting to use graphs. So, I hope that you will forgive my probably basic question.
>
> I run the following command:
>
> histogram ib_scaled_w if ib_scaled_w >-.1 & ib_scaled_w<.1 & country=="AUS"  & sample_sum==1, bin(20) by(post_ifrs) title("AUS") saving (hist_AUS, replace)
>
> post_ifrs is a binary variable (coded 0 or 1).
>
> Is there a way to display the total number of observations corresponding to each of the histograms obtained with the command? (one graph with post_ifrs = 0 and one graph with post_ifrs=1)
>
> I searched in the Graphics Stata manual but did not find the solution.
>
> Best regards
>
> Herve Stolowy
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```