Statalist


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

st: Bar Graph Lower Bound


From   Peter Goff <[email protected]>
To   [email protected]
Subject   st: Bar Graph Lower Bound
Date   Mon, 18 May 2009 13:40:40 -0500

Hi,

I have, what should be, a fairly simple inquiry. I'm graphing a set of bar charts show the average results from a survey. The survey is a likert scale, with values from 1-5. Its misleading to present the graph from 0-5, but I can't force Stata to restrict the lower bound the of the graph. I've used the following sub-options:

	ylabel(1(1)5) ///
	yscale(range(1 5)) ///
	ymtick(1(0.5)5, grid)

I have also set "if" statements in my code graphing only if the values are > 1 (which all are, of course). Zero is always included as a lower bound. How should I fix this? (The whole graph command is below if needed)

Best,
~Pete

levelsof prinid, local(prin)
foreach x in `prin' {
	foreach b in core process {
	if "`b'" == "core" {
	local b1 "Core Components"
	}
	if "`b'" == "process" {
	local b1 "Key Processes"
	}
	use questions, replace
	keep if prinid == `x'
	graph bar q_mean q_prin district_mean,  ///
		legend(order (1 "Teacher Mean" 2 "Prinicpal" 3 "District Mean")) ///
		title("Prinicpal `x'") ///
		subtitle("`b1'") ///
		bar(1, fcolor(gs12) ///
			lcolor(blue) ///
			lwidth(vthin) ///
			lpattern(dash_dot)) ///
		bar(2, fcolor(white) ///
			lcolor(dkgreen) ///
			lwidth(vthin)) ///
		bar(3, fcolor(gs1) ///
			lcolor(brown) ///
			lwidth(vthin)) ///
		ylabel(1(1)5) ///
		yscale(range(1 5)) ///
		ymtick(1(0.5)5, grid)
graph export "/Users/ptgoff101/Documents/Principal Study/Coaching Data/`b1'/`b'_`x'.png", replace graph save "/Users/ptgoff101/Documents/Principal Study/Coaching Data/ `b1'/`b'_`x'.gph", replace
	}
}
Peter Trabert Goff
PhD student
Department of Leadership, Policy, and Organizations
Vanderbilt University

Peabody #514
230 Appleton Place
Nashville, TN 37203-5721
Tel. 615-415-7844
Fax. 615-322-6596
[email protected]




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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