以下是使用R中的一些基本绘图函数的示例:
set.seed(1)
n = 10
x <- runif(n, min=0, max=2)
y <- runif(n, min=8, max=24)
z <- runif(n, min=0, max=100)
#z to cex function
a <- 1
b <- 0.02
z.cex <- a + b*z
example.cex <- seq(1,3,0.5)
example.z <- (example.cex - a)/b
example.z
plot(x, y, pch=21, bg="orange", col="red", cex=z.cex, lwd=2, bty="n", xaxt="n", yaxt="n", xlab="", ylab="")
grid()
axis(1, at=seq(0,2,0.5), pos=16, col="green4", lwd=3)
axis(2, at=seq(8,24,4), pos=1, col="green4", lwd=3)
legend("topright", legend=c(example.z), pch=21, pt.bg="orange", col="red", pt.cex=example.cex, title="sales vol.", bg="white")
Run Code Online (Sandbox Code Playgroud)
