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

st: RE: Marker labels with background color


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Marker labels with background color
Date   Sat, 29 Jan 2005 08:49:52 -0600

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Friedrich Huebler
> Sent: Friday, January 28, 2005 3:37 PM
> To: [email protected]
> Subject: st: Marker labels with background color
> 
> Is there a way to draw marker labels with a background color? The
> otherwise meaningless example below shows what I am trying to
> achieve.
> 
> . sysuse auto
> . scatter mpg weight, connect(l) mlabel(mpg)
> 
> Most labels are difficult to read because a line runs through them.
> Is it possible to draw the labels on top of a white square so that
> the lines don't interfere?
> 
> Thank you,
> 
> Friedrich
> 
> 

Friedrich,

Two possible solutions.

1.  Make the lines lighter so the labels are more noticeable.
2.  Use the -text(, box)- option.

sysuse auto,clear
keep in 1/70
twoway  (connected mpg weight, msymbol(circle) msize(small) ///
 mcolor(gs15) clcolor(gs15) clwidth(thin)) || /// 
(scatter mpg weight, ms(i)  mlabel(mpg) mlabsize(*1.2) legend(off))


forv i = 1/70 {
local textbox "`textbox' text(`=mpg[`i']' `=weight[`i']' "`i'" , ///
bc(white) box)" 
}

twoway (connected mpg weight,  msize(small) clwidth(thin) `textbox' )

However, the -text- option seems limited to 70 boxes.

Hope this helps,
Scott



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