トップ 履歴 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

barplot

*disclaimer
638565

R
R.graph

barplot()


> head(nice2jp)
[1] 233 518 638 341 499 321
> head(nice1jp)
[1] 438 332 213 252 396 500

plot.new()

barplot(
sort(nice2jp), 
xlim=c(0,250), ylim=c(0,1600), 
col = "#00ffff40", border = "#00ffff", 
ylab="words", 
main="NICE1 (Blue) and NICE2 (Light Blue)",
yaxp=c(0, 1600, 16)
)

par(new=T)

barplot(
sort(nice1jp), 
xlim=c(0,250), ylim=c(0,1600), 
col = "#0000ff40", border = "#0000ff", 
yaxp=c(0, 1600, 16)
)

grid(NA, 16)


x軸の項目名を90度回転するオプション las=2

> par(mar=c(13, 3, 3, 3))
> barplot(head(jp2gram2$freq, 50), srt=90, names.arg=head(jp2gram2$bigram, 50), las=2)


data.frameからmatrixにして棒グラフを描く

> head(xjm)
     p1c1a p5c2a p2c3a p7c4a p6c5a p3c6a p4c7a p8c8a p8c1b p4c2b p3c3b p6c4b p7c5b p2c6b p5c7b p1c8b
[1,]  1070   656   840  1114  1070   758  1043   970  1063  1006   837  1218   986   814   628   999
[2,]   815   863   833   814   771   795   841   777   879   852   839   815   790   831   821   764
[3,]   812   858   835   810   771   794   834   770   877   852   831   812   782   832   818   761
[4,]   950   950   666   703   896   799   761   588   537   671   831   806   742   717  1001   915
[5,]   640   679   651   642   680   697   673   644   542   582   591   608   639   627   676   662
[6,]   574   597   728   688   620   513   730   615   625   789   551   677   667   665   551   564

barplot(
xjm[1,1:8], ylim=c(0,1200),
col = "#00ffff40", border = "#00ffff"
)

par(new=T)

barplot(
xjm[1,9:16], ylim=c(0,1200),
col = "#0000ff40", border = "#0000ff", 
)


  • 参考サイト

https://stats.biopapyrus.jp/r/graph/barplot.html