LoginSignup
0
1

More than 5 years have passed since last update.

R 色見本とプロット点の形

Last updated at Posted at 2017-11-17

色見本

plotの引数pch種類

x = c(rep(1,5),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
y = rep(seq(1,5,1),5)
plot(x,y,pch=c(seq(1,25,1)),xlim = c(0.5,5.5),ylim=c(0.5,5.5),xlab = "",ylab = "")
text(x,y,1:25,pos = 3) #上に書く

Rplot_pch.png
図の番号とpchの番号は同じなので、プロットしたい形の番号を指定すれば番号の形がプロットされる


install.packages("RColorBrewer", dependencies=T)  # RColorBrewer のインストール(初回のみ必要なコード)
library(RColorBrewer)  # RColorBrewerの呼び出し(毎回必要。名前が長い…忘れてしまうorz)
display.brewer.all()  
brewer.pal(8, "YlOrRd") # Greensを選択する場合。数字は色数(段階数)
# ただし、各セットに用意されている色数を超えて指定することはできない(cf. 上図)
brewer.pal(8, "Greens")[1] # 実際の使用では[1]のように添字を付けて色を取り出す


Rplot06.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1