[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Histogram with options |

Date |
Tue, 13 Aug 2002 13:31:41 +0100 |

Karin Gilland > I can never seem to get the histogram syntax quite right - have experimented > for ages with the syntax. I would like to have the following features in the > histogram: > 1. The variable has 8 categories, and I would like each category to be one > bin. (Even when I include -bin(8)- in the syntax I get fewer bins sometimes). Presumably your variable consists of equally spaced values, such as consecutive integers. Some of the bins may be empty in some cases. Otherwise I cannot diagnose this from the evidence supplied. I would need to see data and what you typed. > 2. Each bin should be labelled. (I have made value labels, but only the labels > for the bins at the extreme left and right appear, not the ones in the > middle). With say values 1(1)8, you could go ... xla(1/8) xsc(0.5,8.5) or check out -hist-. > 3. The x axis should preferably not have any ticks. When you say "ticks", I guess you mean "unlabelled ticks". Usually achieved by something like the above. > 4. The height of each bin shows the relative proportion of votes parties > received in a recent election (New Zealand). I guess this means I should > include the "freq" option in the syntax? I don't know what you mean by "relative proportion" here. Is this what you want or what you get? > 5. The y axis should range from 0 to 50, with ticks at 0, 10, 20, 30, 40, 50. When you say "ticks", I guess you mean labels. .... ysc(0,50) yla(0(10)50) But in general, this does not sound like a variable which should be plotted as a histogram, as you have categories which are not on a continuous scale. You perhaps need a bar chart. Check out (e.g.) -fbar- from SSC. In general, your value labels will be truncated at eight characters whenever you use any graph command based on -graph-. -graph, histogram- is one and -hist- and -fbar- are others. This is only soluble in Stata by using graph commands based directly on -gph- such as -hplot- or -hbar-. For locations of non-official programs, use -findit-. Nick n.j.cox@durham.ac.uk * * 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/

- Prev by Date:
**st: Nick: Thank you (re maximum 'run' of observations in panel data) No msg below. ..Frank** - Next by Date:
**st: Parsing of multiple -if- lines** - Previous by thread:
**Re: st: Histogram with options** - Next by thread:
**st: Re: Empirical Bayes using meta ado** - Index(es):

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