Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: rugs, marker labels and legends....

From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   st: rugs, marker labels and legends....
Date   Tue, 24 May 2005 11:40:28 +0100

Dear statalisters,

I'm attempting to draw a series of histograms each with two overlaid rugs underneath 
as described in Cox NJ (2004) The Stata Journal 4(1):99-88, and I have two problems 
which I would be grateful of assistance with.

1) As per the description in the SJ article, I'm using the '|' (pipe symbol) as marker 
labels, but because I am overlaying two rugs (see code below), I would like to have a 
legend which indicates what each refers to.  However, because the -ms(none)- option is 
used to suppress the normal marker symbol, no marker symbol is shown in the legend 

A work around that I thought of was to use a very small marker symbol that would be 
masked by the '|' variable that is specified, and then use the symysize() and symxsize() 
legend contents options.  This leaves the rugs as desired, and does result in the legend 
being defined, but the marker symbols are barely legible as the symysize() and 
symxszie() options seem to be ignored.

Ideally I would like to include the '|' symbol in the legend, but can not find anything in the 
legend section of the manuals or help files on how to do this.

2) A minor problem, but when the histogram is drawn with the -freq- option the 'rugs' 
overlay the base of the histogram.  This does not occur if the default -density- option is 
used (I've also checked this with the example used in the SJ and you see overlap in that 
data set when the -freq- options is specified on the histogram).

Details of Stata version

Version	      8.2
Born          10 Jan 2005

Code (rather convoluted, and apologies for not devising a universal example)

histogram order if(dups == 1), by(region, title("Distribution of tagging and tagged SNPs" 
"in the CEPH (NW Europe ancestry) pop", size(medium)) legend(symysize(*5) 
symxsize(*5) at(11) pos(0))) start(0) bin(500) freq plot(scatter where1 order if(dups == 1 
& tag_snp100k ~= ""), ms(none) mlabel(pipe) mlabpos(0) || scatter where1 order if(dups 
== 1 & tag_snp100k == affy100k), ms(none) mlabel(pipe) mlabpos(0)) scheme(s1color)

An example of the graph that I have managed to generate so far can be viewed at

I'd be very grateful if anyone can suggest any solution to either of the above problems.

Many thanks in advance,


Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]

"If your result needs a statistician then you should design a better experiment" - 
Ernest Rutherford

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index