Statalist


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

st: RE: Trellis plot without duplicate labels


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Trellis plot without duplicate labels
Date   Fri, 27 Jun 2008 18:25:34 +0100

You seem to be missing the -ycommon- option of -graph combine- and
-plotregion(margin())-. 

Nick 
n.j.cox@durham.ac.uk 

Allan Reese 

Under axis_label_options in the V9 graphics manual, the option
x/ylabel(,nolabels) is described with the challenge, "Why anyone would
want to do this is difficult to imagine."

I've made an array of line plots, each pane demonstrating that a
measurement varied very little over time.  A nominal +/- 10% of mean
line is drawn around each line plot, and the panes are stacked as a
column with common time axis.  Removing chart junk therefore involves
removing all but the bottom xaxis line and labels (the line being close
to each -10% reference line) but I did want to repeat the ticks to aid
time-referencing.

Here's the commands, simplified, for the last couple of panes:

scatter  y1 time, c(l) ti("Deviations from mean percentage measurement")
yti("%", orientation(horizontal))
   t2(lines at +/- 10% of mean)  
   xti("") xscale(range(0 25) noline) xlab(0(4)24, nolabel)
   yli(0 +.28 -.28, lcol(gs4)) ylab(-.2 0 "0" .2 .28, angle(0)
format(%3.2f) labsize(*1.2) ) yscale(range(+.28 -.28))   
   scheme(s1mono) plotregion(style(none)) name(g1,replace);

scatter  y2 time, c(L) yti(" ") 
   xti("") xscale(range(0 25) noline) xlab(0(4)24, nolabel) 
   yli(0 +10 -10, lcol(gs4)) ylab(-4 0 "0" 4 10 ,angle(0) format(%3.2f)
labsize(*1.2) ) yscale(range(+10 -10))   
   scheme(s1mono) plotregion(style(none)) name(g2,replace);

...
scatter  yn time, c(L) yti(" ") 
   xti("Hours") xlab(0(4)24) 
   yli(0 +2 -2, lcol(gs4)) ylab(-1 0 "0" 1 2,angle(0) format(%3.2f)
labsize(*1.2) ) yscale(range(+2 -2))   
   scheme(s1mono) plotregion(style(none)) name(gn,replace);

* then to assemble trellis;
graph combine g1 g2 ... gn, col(1) xsize(2) ysize(6) imargin(zero)
scheme(s1mono); 
--------------------------

Making the Y axes line up exactly was hard; I'm not sure if it's
achieved but it looks near. Formally, I'd like the ytitle to extend left
from its start rather than right.

Something I haven't achieved is to put the ticks on the 0 line of each
plot rather than outside the plot area.  Any ideas?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index