Statalist


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

st: RE: Altering individual data markers in a graph


From   Howard Lempel <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Altering individual data markers in a graph
Date   Tue, 30 Jun 2009 15:27:28 -0400

Another option:

gen col = "black"
replace col = "red" if colorcode == "R"
replace col = "yellow" if colorcode == "Y"
replace col = "blue" if colorcode == "B"

separate pressure, by(col)

twoway scatter pressure1 pressure2 pressure3 pressure4 age ///
	, mcolor(black blue red yellow)

You may have to play with the order of the colors to make sure it works like you want.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ron Gutmark
Sent: Tuesday, June 30, 2009 3:04 PM
To: [email protected]
Subject: st: Altering individual data markers in a graph

Hi,
I am trying to make a scatter plot (of eye pressure vs. age) and
change the color of particular markers.  I have a variable called
"colorcode" in which I store a single letter depending on what color I
want the marker to be (i.e. B for blue, R for red, Y for yellow).

I tried doing this (see below), but it doesn't work:

 gen col = "black"
 replace col = "red" if colorcode == "R"
 replace col = "yellow" if colorcode == "Y"
 replace col = "blue" if colorcode == "B"
 graph twoway (scatter pressure age, mcolor(col))

When I try to make the graph it says: "(note:  named style col not
found in class color, default attributes used"

Any input on what I'm doing wrong and how I can fix it would be
greatly appreciated (or suggestions on other ways to do this).
Thank you!!!

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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