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

st: graph legend overlay

From   Bill Rising <[email protected]>
To   "Stata Listserve" <[email protected]>
Subject   st: graph legend overlay
Date   Sat, 4 Oct 2003 20:46:12 -0400

Hello people,

Is there some way to overlay legend items on each other?

Here's the deal:

I've made a combination of two -rcap- graphs together with two -scatter- 
plots superimposed, and the symbols have the value of a 3rd variable 
inside the symbol. Here's a text version:

   |   \__/         |

Now, I'd like to be able to at least have a bar with a symbol in the 
legend, properly labeled, along with a note about the number in the 

Unfortunately, I cannot see how to superimpose legend items as easily as 
superimposing graph items. The best I seem to be able to do is to make 
the -symysize- and -rowgap- very small (negative works like very small) 
and get the bar and the symbol close.

Here are the other unsuccessful attempts:

Calling both the symbol and the bar item 1 within their various graph 
subcommands. Stata is not fooled, however, and instead merges their 
directives for the first of the items.

The code for the graphs follows at the bottom, for those who are 

Thanks in advance,


---------------------------- cut here ---------------------------- 
#delimit ;
graph twoway 
	(rcap comfort_hi comfort_low q_by_comfort_pre 
	   if when==0 & year4==0, 
	       ylabel(1/20, valuelabel angle(horizontal)) 
	(rcap comfort_hi comfort_low q_by_comfort_pre 
	   if when==1 & year4==0, 
	(scatter q_by_comfort_pre comfort_avg
	    if when==0 & year4==0
	    , mlab(exposed_pct) mlabpos(0) mlabsize(vsmall) mlabcolor(black)
	      msymbol(O) msize(large) mcolor(yellow)
	(scatter q_by_comfort_pre comfort_avg
	    if when==1 & year4==0
	    , mlab(exposed_pct) mlabpos(0) mlabsize(vsmall) mlabcolor(black)
	      msymbol(O) msize(large) mcolor(orange)
	, ytitle("<- More Difficult ... Less Difficult ->") xtitle("Comfort 
	legend(order(1 2 3 4) label(1 "") label(2 "") label(3 "Before") label(4 
	       symysize(-0.5) rowgap(-0.5) )
---------------------------- cut here ---------------------------- 
*   For searches and help try:

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