Statalist


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

st: weight marker symbol fill size and color?


From   David Airey <david.airey@Vanderbilt.Edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: weight marker symbol fill size and color?
Date   Sun, 24 Aug 2008 10:42:43 -0500

.

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)
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index