Statalist


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

st: Trellis plot without duplicate labels


From   "Allan Reese (Cefas)" <allan.reese@cefas.co.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Trellis plot without duplicate labels
Date   Fri, 27 Jun 2008 17:14:58 +0100

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?

Allan




***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   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