实用R配色技巧

随机生成点的大小、颜色和位置,分别用空心点和实心点画图。

par(mar = c(0.2, 0.2, 0.2, 0.2), mfrow = c(2, 2))
for (n in c(63, 60, 76, 74)) {
set.seed(77)
plot.new()
size = c(replicate(n, 1/rbeta(2, 1.5, 4)))
center = t(replicate(n, runif(2)))
center = center[rep(1:n, each = 2), ]
color = apply(replicate(2 * n, sample(c(0:9,
LETTERS[1:6]), 8, TRUE)), 2, function(x) sprintf("#%s",
paste(x, collapse = "")))
points(center, cex = size, pch = rep(20:21, n),
col = color)
box()
}

效果图
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • From shirinsplayground,非常好的机器学习的文章,保存下来,慢慢学习。 https://shi...
    iColors阅读 1,247评论 0 0
  • ####2019#### library(tseries) library(forecast) library(T...
    woaishangxue阅读 643评论 0 0
  • 0228 1.some refernce materialR CookbookR in Actionggplot2...
    TX_ab85阅读 834评论 0 0
  • 实验课代码 实验一 #练习一 # 1.1 产生一个等差数列(1,3,5,7,……,99)赋值给向量x,尝试不同的方...
    jenny1128阅读 507评论 0 0
  • #### Section 4: demo code for xgboost (Extreme GB) #### #...
    TXJY阅读 680评论 0 0