g <- symbolmap(inputs=letters[1:10], pch=11:20)
plot(g)
## squares and circles with area proportional to |x|
## For 'squares', size is side length; size = sqrt(area)
## For 'circles', size is diameter; size = sqrt(area * 4/pi)
g2 <- symbolmap(range=c(-1,1),
shape=function(x) ifelse(x > 0, "circles", "squares"),
size=function(x) ifelse(x > 0,
sqrt(abs(x)*4/pi),
sqrt(abs(x))),
bg = function(x) ifelse(abs(x) < 1, "red", "black"))
plot(g2, vertical=TRUE, side="left", col.axis="blue", cex.axis=2)
plot(g2, representatives=c(-1,0,1))
## logarithmic display scale
gl <- symbolmap(range=c(1,1000), pch=21,
bg=function(x) ifelse(x < 50, "red", "blue"),
cex=function(x) ifelse(x < 100, 1, 2),
compress=log10)
gl(10)
plot(gl, nsymbols=4)
## logarithmic symbol map
gll <- symbolmap(range=c(1,1000),
transform=log10, size=function(x) { 1 + x },
compress=log10)
gll(10)
plot(gll, nsymbols=4)
Run the code above in your browser using DataLab