Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: sts graph: specifying line pattern options

From   "Philip Ryan" <>
To   <>
Subject   st: RE: sts graph: specifying line pattern options
Date   Mon, 24 May 2010 16:28:11 +0930


When you specify the "formula" I think you need to enclose the symbol(s) for
_each_ line in double quotes. So

sts graph, by(drug)  plotopts(lpattern("."  "-"  "-.-.")  lcolor(black blue

However this does not appear to help.  It looks like -sts graph- takes the
first line pattern specified, applies it to each of the lines, and ignores
the last two.  Similarly lcolor() only obeys the first colour specified.
It's a bit more obvious if your first colour is other than black.  Try:

sts graph, by(drug) plotopts(lpattern("."  "-"  "-.-.")  lcolor(red blue

I don't have this problem with -graph twoway line yvar1  yvar2  yvar3  xvar,
lpattern(...) lcolor(...)-

I'm using Stata/SE 64 bit on W/Vista with all latest updates.  If someone
else can reproduce this problem then StataCorp would need to have a look at
the code for -sts graph-.


Philip Ryan
Professor and Director
Data Management & Analysis Centre
University of Adelaide 
-----Original Message-----
[] On Behalf Of Michael McCulloch
Sent: Monday, 24 May 2010 2:16 PM
To: Statalist Statalist
Subject: st: sts graph: specifying line pattern options

In v9 of Stata, I used to specify line pattern options in -sts graph-.  
In the example that follows, one group would be plotted in a solid  
line, one in dash, and one in long dash. All in black:

*** begin example
sysuse cancer.dta
stset studytime, failure(died)
version 9: sts graph, by(drug) lpattern(l - _) lcolor(black blue red)
*** end example

In v11, -lpattern()- needs to be contained within option -plotopts-,  
but in this example below, all  three groups have the same line  
pattern and color:
. sts graph, by(drug) plotopts(lpattern(l - _) lcolor(black blue red))

I tried "formula", but this makes all three groups
sts graph, by(drug) plotopts(lpattern("l - _") lcolor(black blue red))

Any help would be appreciated,

Michael McCulloch, LAc MPH PhD
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel:	415-407-1357
fax: 	206-338-2391

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index