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: xtline: options for line color

From   "Martin Weiss" <>
To   <>
Subject   st: RE: xtline: options for line color
Date   Tue, 20 Jul 2010 23:06:51 +0200


You may want to rephrase your question in terms of an example that is within
reach of Statalist users:

sysuse xtline1, clear
xtline calories, overlay

Scheme "sj" is black and white, so I do not understand how one could change
the "color" of a line in there...


-----Original Message-----
[] On Behalf Of Alison Drake
Sent: Dienstag, 20. Juli 2010 22:41
Subject: st: xtline: options for line color

I would like to change the color of lines for subgroups on a graph generated
by xtline.  I want to create an overlay of the lines by 2 different groups,
group 0 and 1 and have the lines for group 0 be one color and group 1 be
another color.  Currently, I can?t figure out how to change the line options
unless I use a scheme, and I haven?t been able to adjust the line options by

The code I am using now (which I have also added 2 lowess curves to) shows
the plasmaVL for each id using the sj scheme color (see below).  Can anyone
help me get different colors of lines by group? Instead of scheme(sj) I have
tried lcolor (green) to try to adjust the color for all, as well as lcolor
if group==0 or if group==1 without success.  I?m not sure this is possible
with xtline?

xtset idno visitno
xtline plasmaVL,   overlay legend(off) scheme(sj) xlabel(0(1)1)
title("Plasma HIV viral load over time, by treatment group")  ytitle("Log10
copies/mL") /*
*/ xtitle("Visit number")  addplot ((lowess plasmaVL visitno if group==0,
lcolor(blue) lpattern(solid) lwidth(thick))/*
*/(lowess plasmaVL visitno if group==1, lcolor(red) lpattern(solid)


Alison Drake, MPH
Pre-doctoral Fellow
Department of Epidemiology
University of Washington
Box 359909
Seattle, WA 98195-7236
phone: (206) 579-9211

*   For searches and help try:

*   For searches and help try:

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