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

st: Re: help with a histogram by year

From   "Martin Weiss" <>
To   <>
Subject   st: Re: help with a histogram by year
Date   Mon, 9 Mar 2009 20:26:18 +0100

I am not sure whether the value of the by var is accessible with -by- so I am using -graph combine- here

sysuse auto, clear
g year=cond(runiform()<0.3,1978, cond(runiform()<0.6,1979,1980))

levelsof year, loc(levels)
foreach year of loc levels{
hist mpg, graphregion(color(white)) freq title("This is for year `year'") name(hist`year', replace) nodraw

graph combine hist1978 hist1979 hist1980, plotregion(ifcolor(white))

----- Original Message ----- From: "F. Gao" <>
To: <>
Sent: Monday, March 09, 2009 3:19 PM
Subject: st: help with a histogram by year

Dear members,

I am trying to get a histogram by year. I use the following command

hist y, by(year,graphregion(color(white))) freq

Two things annoy me so far.

1. I do not know how to get rid of the note on the lower left part of
the graph "Graphs by year". I tried adding
   note(`"   "')
   at the end of the command, with no effect

2. I would like to add a small title under each graph for each year,
such as "For year 1990", "For year 1991", so that I could replace the
title added by stata automatically on the top of each graph, like
"1990", "1991".

Any suggestions would be greatly appreciated.



*   For searches and help try:

*   For searches and help try:

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