[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"FEIVESON, ALAN H. (AL) (JSC-SK) (NASA)" <alan.h.feiveson@nasa.gov> |

To |
"statalist (statalist)" <statalist@hsphsun2.harvard.edu> |

Subject |
st: variable color in Stata 8 plot |

Date |
Fri, 24 Jun 2005 15:31:09 -0500 |

Title:

Hello - I would like to plot y vs x with the plot symbol changing color depending on a third variable, say z. Is this possible to do in Stata 8 without defining separate y's for each value of z? For example, if I wanted to plot with a different symbol, I could do something like

gen str1 sym="A" if z==0

replace sym="B" if z=1

scatter y x,mlab(sym)

What I would like to do is

gen str4 sym = "red' if z==0

replace sym="blue" if z==1

scatter y x,mcolor(sym)

except it doesn't work.

I know I could accomplish this by

gen y0 = y if z==0

gen y1=y if z==1

scatter y0 y1x,mcolor(red blue)

but I am going to do this for a lot of different y's and I don't want to create 2 new variables for each one of them.

Al Feiveson

**Follow-Ups**:**Re: st: variable color in Stata 8 plot***From:*Nick Winter <nw53@cornell.edu>

- Prev by Date:
**RE: st: reshaping data** - Next by Date:
**Re: st: variable color in Stata 8 plot** - Previous by thread:
**st: RE: reshaping data** - Next by thread:
**Re: st: variable color in Stata 8 plot** - Index(es):

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