html5 控制坐标轴颜色,R语言基本绘图-plot参数:标题,坐标轴和颜色

plot函数参数

标题

plot(c(1:2,2:4),main = "这是主标题",sub = "这是副标题",xlab = "这是x轴", ylab = "这是y轴")

坐标轴筛选

plot(c(1:20,10:30,15:40))

plot(c(1:20,10:30,15:40),xlim = c(10,80),ylim = c(20,40))

颜色

单一颜色

命令行输入colors(),可以查看所有可用的颜色(当前有657种颜色可供使用)

PDF版本下载地址

http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf

可在参数中直接使用颜色名或色值调用:

plot(c(1:20,10:30,15:40),col = "blue"))

颜色系统

R语言预设了五个基本配色系统,分别为rainbow,heat.colors,terrain.colors,topo.colors和cm.colors色阶如下

实现脚本[1]

par(mfrow=c(1,5),mar=c(0.5,0.5,2,0.5),xaxs="i",yaxs="i")

n

barplot(rep(1,times=n),col=rainbow(n),border=rainbow(n),horiz=T,axes=F,main="Rainbow Color")

barplot(rep(1,times=n),col=heat.colors(n),border=heat.colors(n),horiz=T,axes=F,main="Heat.Colors")

barplot(rep(1,times=n),col=terrain.colors(n),border=terrain.colors(n),horiz=T,axes=F,main="Terrain.Colors")

barplot(rep(1,times=n),col=topo.colors(n),border=topo.colors(n),horiz=T,axes=F,main="Topo.Colors")

barplot(rep(1,times=n),col=cm.colors(n),border=cm.colors(n),horiz=T,axes=F,main="Cm.Colors")

绘制图形时可做如下应用:

par(mfrow=c(2,3),mar=c(0.5,0.5,0.5,0.5),

n = 10

map("world",fill = T, col = rainbow(n)); title("rainbow")

map("world",fill = T, col = heat.colors(n)); title("heat.colors")

map("world",fill = T, col = terrain.colors(n));title("terrain.colors")

map("world",fill = T, col = topo.colors(n));title("topo.colors")

map("world",fill = T, col = cm.colors(n));title("cm.colors")

其他方式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值