Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Bar Graph Questions

From   Finne Håkon <>
To   <>
Subject   st: RE: Bar Graph Questions
Date   Wed, 15 Sep 2004 11:49:20 +0200

here are a couple of hints.
a. Make sure your months are numerical and either interpreted or labeled as dates. See [U] chapter 27.
b. This allows you to use -graph twoway bar- , which is for a numerical x, rather than -graph bar-, which is for a categorical x.
c. Then you should be able to use the -xlabel(lowest(interval)highest)- option to determine which months to label. You may have to fiddle around with the starting value to get it right. See [G] graph twoway area for some hints.
When you are using -graph twoway-, you can overlay two plots, using the notation 
-graph twoway (bar olddeath month, plot_options) (bar newdeath month, plot_options), graph_options-
(or the || notation). Make sure the olddeath data only go up to your chosen cutoff point and make a newdeath variable dealing with the tallest columns. Then fiddle around with appropriate ways of scaling the two y axes. Add some adornment to make the cutoff visible. See [G] graph twoway bar (p. 244) for some ideas to get you started.

-- Håkon

-----Original Message-----
From: [] On Behalf Of Dasovic, Josip
Sent: 15. september 2004 08:30
Subject: st: Bar Graph Questions

I have tried searching the appropriate places for help with bar graphs, but have come up empty-handed.  I hope that list members may be able to help me with two questions regarding bar graphs.
1)  I am creating a series of bar graphs of monthly numbers of deaths spanning almost ten years.  I get exactly what I want, except for the labels on the x (i.e. categorical) axis.  Stata, logically, keeps all the labels.  I would like to keep a subset of the labels (e.g. Jan1991, August 1991, Jan1992, etc.) and haven't been able to find a way to do this.  I have tried to remove the non-needed labels (i.e., Feb1991, March1991, etc.) from the variable itself and then create the graph, but to no avail.  Any hints?
2) One of the columns is of a magnitude greater than the other columns.  (While most columns values vary from 0 to 50, in one month the value is over 500).  How do I fix the yscale so that it is appropriate (i.e., goes from 0 to 60, say, and place one of those fancy breaks in the one column that is much larger than the others?

*   For searches and help try:

*   For searches and help try:

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