|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Graphics link: tiled, labelled histograms
This link will take you to some simple but effective graphics:
<http://graphics8.nytimes.com/packages/flash/politics/20080603_MARGINS_G
RAPHIC/margins.swf>
I learned of this from Andrew Gelman's blog. Andrew credits Chris Zorn
for alerting him.
The interactive aspects are neat, although arguably not crucial for
analysis.
A more prosaic question is: can you do similar (static) graphs in Stata?
A direct attack would be to write a program that would produce a tiled,
labelled
histogram in more or less cartographic fashion.
An easier fudge is to use the existing -stripplot- from SSC. I don't
have the data behind the link above, which are for Clinton vs Obama
support, but a loosely similar example is
to hand:
sysuse census, clear
local abbrev ///
AK AL AR AZ CA CO CT DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO
///
MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI
WV WY
gen abbrev = ""
tokenize "`abbrev'"
qui forval i = 1/50 {
replace abbrev = "``i''" in `i'
}
set scheme s1color
stripplot medage, stack ms(Sh) msize(*3.5) width(0.5) ///
mla(abbrev) mlabpos(0) mlabsize(*.9) ysc(off) plotregion(lstyle(none))
///
more
stripplot medage, stack ms(S) msize(*3.5) mcolor(black) width(0.5) ///
mla(abbrev) mlabpos(0) mlabsize(*.9) mlabcolor(white) ///
ysc(off) plotregion(lstyle(none))
more
stripplot medage , stack ms(S) msize(*3.5) mcolor(gs14) width(0.5) ///
mla(abbrev) mlabpos(0) mlabsize(*.9) mlabcolor(black) ///
ysc(off) plotregion(lstyle(none))
A downside of this is that the ensuing graphs are fragile in terms in
getting symbol and text sizes right. -graph combine- and things go to
pot, although the Graph Editor is to hand for corrective surgery.
*
* 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/