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

From |
"Stas Kolenikov" <skolenik@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: weight marker symbol fill size and color? |

Date |
Sun, 24 Aug 2008 11:23:17 -0500 |

The only way (at least that I know of) to change color is to split your data and do several scatterplots: twoway (scatter ... if z>=9, ... mcolor(gs12)) (scatter ... if z>7.5 & z<9, ... mcolor(gs8)) (scatter ... if z<7.5, ... mcolor(gs4)) This can probably be automated with a ~15 line wrapper program that takes in z, y, z and the thresholds. Graphics in R is notably stronger than in Stata. On Sun, Aug 24, 2008 at 10:42 AM, David Airey <david.airey@vanderbilt.edu> wrote: > . > > At this page, we see how to change symbol size by using (analytic) weights: > > http://www.stata.com/support/faqs/graphics/gph/graphdocs/scatter5.html > > e.g., > > webuse census > scatter death medage [w=pop65p], msymbol(circle_hollow) > > Can we change both symbol size and color shading as in the R example below? > > -Dave > > ###------------------create the test data.frame > y = c(.4, 1, 2.15, 1.8, 2.7, 2.2, 1.3, .25, 1.1, .1) > x = c(.35, .4, .41, 1.4, 2.1, 2.25, 2.15, 2.2, 1.45, 1.3) > z = c(9, 7, 7.5, 7.3, 7, 7.1, 7.75, 9.5, 8, 10) > d = data.frame(x = x, y = y, z = z) > > d$col = gray(.5) > d$col[d$z>=9] = gray(.2) > d$col[d$z<7.5] = gray(.7) > #thikness = sqrt(d$y^2 + d$x^2) > thikness = abs(d$y) + abs(d$x) > > > ###----------------simple, 2-D plot > plot(d$x, d$y, pch=19, cex=(d$z-min(d$z)/1.5), xlim = c(-1.5,4), ylim = > c(-2.5,5), col=d$col) -- Stas Kolenikov, also found at http://stas.kolenikov.name Small print: I use this email account for mailing lists only. * * 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/

**Follow-Ups**:**Re: st: weight marker symbol fill size and color?***From:*David Airey <david.airey@Vanderbilt.Edu>

**References**:**st: weight marker symbol fill size and color?***From:*David Airey <david.airey@Vanderbilt.Edu>

- Prev by Date:
**st: bihistogram** - Next by Date:
**Re: st: weight marker symbol fill size and color?** - Previous by thread:
**st: weight marker symbol fill size and color?** - Next by thread:
**Re: st: weight marker symbol fill size and color?** - Index(es):

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