I didn't see the complication you mentioned. That makes it trickier.
Consider this. I don't think the overlaid lines work well. I don't know
how to get lines as backdrop that don't extend over the whole plot
region, but I think plain -xli()- would look much better.
------------------------------------------------ cut here
use http://www.stata-press.com/data/r10/auto, clear
preserve
tempfile mylabel
label save origin using `mylabel'
// map 1..5 -> 3..7 to ensure offset from -foreign-'s values of 0 1
replace rep78 = rep78 + 2
stack price foreign weight rep78, into(data foreign) clear
// bring back labels
label def _stack 1 "`l1'" 2 "`l2'"
label val _stack _stack
do `mylabel'
// reverse -rep78- offset in labels
label def origin 3 "1" 4 "2" 5 "3" 6 "4" 7 "5", add
label val foreign origin
// now...
graph hbox data, over(foreign)
// or
stripplot data, over(foreign) box(barw(0.6)) ysc(reverse) ///
addplot(scatteri -0.5 4000 1.5 4000, recast(line) lcolor(gs12) ///
|| scatteri -0.5 8000 1.5 8000, recast(line) lcolor(gs12) ///
|| scatteri 2.5 2000 7.5 2000, recast(line) lcolor(gs12) ///
|| scatteri 2.5 3000 7.5 3000, recast(line) lcolor(gs12)) ///
ytitle(" Repair record
Foreign") ///
xtitle("Price and weight") yla(, noticks)
restore
------------------------------------------------ cut here
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Laura Gibbons
Sent: 07 November 2007 23:42
To: [email protected]
Subject: RE: st: RE: graph plot region size control
Nick, these are some great tricks that I was not aware of. Thank you!
In the second section, the over variable is rep78, not foreign. I
changed
the stack command to:
stack price foreign weight rep78, into(data foreign) clear
Now I get a problem I had before when I tried a less elegant approach.
The groups are now "Domestic Foreign 2 3 4 5". Is there a way to fix
that so that the value 1 is labeled "Foreign" in the first figure and
"1"
in the second? Also there must be a way to supress the not applicable
values; I haven't investigated that yet.
Finally, I'd like the ylines only on the applicable section, 4000, 8000
for foreign and 2000 3000 for rep78. Am I dreaming?!
*
* 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/