Statalist The Stata Listserver


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

Re: st: label graphs


From   "Sebastian F. B�chte" <[email protected]>
To   [email protected]
Subject   Re: st: label graphs
Date   Fri, 22 Dec 2006 15:17:42 +0100

On 12/21/06, Lucy Shum <[email protected]> wrote:

Maybe my initial question is better illustrated as follows:

Column 1   Column 2
1               4
3               10
4               21
5               4
6               3

So, I want to graph the frequency which is represented by Column 2, but the
x-axis to be expressed by figures in column 1.
Do you mean sth like this?
I am using the levelsof command to retrieve all levels of the variable
col1 and col2 and store them in a local macral. I later use the to
local macros in the y/xlabel statement:

/* example beginn */
clear
input col1 col2
1               4
3               10
4               21
5               4
6               3
end

quiet levelsof col1, local(lev_col1)
quiet levelsof col2, local(lev_col2)

#delimit ;
twoway bar col2 col1,
	xlabel(`lev_col1', grid)
	ylabel(0 `lev_col2', grid)
;
/* example ends here */
*
*   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/



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