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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Altering individual data markers in a graph |

Date |
Tue, 30 Jun 2009 20:16:38 +0100 |

There is no way this approach will work. -mcolor()- will not look inside a string variable. Also, each scatter plot uses precisely one colour. However, the problem is soluble otherwise. One way to proceed is as follows: graph twoway (scatter pressure age if colorcode == "R", mcolor(red)) (scatter pressure age if colorcode == "Y", mcolor(yellow)) (scatter pressure age if colorcode == "B", mcolor(blue)) Another is to use -separate- first. See the online help. Also see SJ-5-4 gr0023 . . . . Stata tip 27: Classifying data points on scatter plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/05 SJ 5(4):604--606 (no commands) tips for using separate, gray-scale gradation, and text characters as class symbols to classify data points on a scatter plot Nick n.j.cox@durham.ac.uk Ron Gutmark 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). * * 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/

**References**:**st: Altering individual data markers in a graph***From:*Ron Gutmark <rgutmar1@jhmi.edu>

- Prev by Date:
**RE: st: adoupdate question** - Next by Date:
**Re: st: match two datasets** - Previous by thread:
**st: RE: Altering individual data markers in a graph** - Index(es):

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