忍者ブログ
2

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

a=gl(2, 10, labels=c("a1", "a2"))
b=rep(gl(2, 5, labels=c("b1", "b2")), 2)
value=c(1:5, 2:6, 6:10, 4:8)

aovres <- aov(value~a*b)
summary(aovres)
model.tables(aovres, "means")

# 1要因のプロット
library(gplots)
plotmeans(value~a)

# 2要因のプロット
interaction.plot(x.factor=a, trace.factor=b, response=value)

PR
こちらのページを参考。参考というかコピペ。感謝
http://hosho.ees.hokudai.ac.jp/~kubo/log/2010/kubolog20100215.html

plot(1:10) # まず最初のプロット (x 軸と y 軸(左側)が書かれる)
print(par("usr")) # その時のユーザー座標系
par(usr=c(par("usr")[1:2], 100.8, 105.2)) # ユーザー座標系を変更 (x 座標系はそのまま)
points(1:5, 105:101, type = "b", col="red") # 追加の点を変更座標系に赤色で書く (軸は書かれない)
axis(4, col = "red") # 変更座標系の (y) 軸を右側に書く

普通はy軸の目盛が左に倒れている
plot(1:10)

lasというパラメータで右に90°回転させる
win.graph()
plot(1:10, las = 1)
## 軸と水平、という指定
## axisの中でも指定できる
plot(1:10, yaxt = "n")
axis(2, las = 1)


# 以下参考
win.graph()
plot(1:10, las = 0)
win.graph()
plot(1:10, las = 1)
win.graph()
plot(1:10, las = 2)
win.graph()
plot(1:10, las = 3)
プロポーショナルで英数字、日本語で等幅でタイトルを書く
plot(1:10, xlab = "")
title(xlab = "WIC      ", familiy = "serif")
title(xlab = "   テスト", family = "Japan1GothicBBB")


Rで使えるpdfフォント
 
> names(pdfFonts())
[1]  "serif"                "sans"                 "mono"
[4]  "AvantGarde"           "Bookman"              "Courier"
[7]  "Helvetica"            "Helvetica-Narrow"     "NewCenturySchoolbook"
[10] "Palatino"             "Times"                "URWGothic"
[13] "URWBookman"           "NimbusMon"            "NimbusSan"
[16] "URWHelvetica"         "NimbusSanCond"        "CenturySch"
[19] "URWPalladio"          "NimbusRom"            "URWTimes"
[22] "Japan1"               "Japan1HeiMin"         "Japan1GothicBBB"
[25] "Japan1Ryumin"         "Korea1"               "Korea1deb"
[28] "CNS1"                 "GB1"
# 4種類の棒グラフ
barplot(1:4, angle = 45 * 0:3, density = 15, col = "black")

# 8種類の棒グラフ
barplot(1:8, angle = 45 * 0:7, , density = c(rep(15, 4), rep(25, 4)), col = "black")
プロフィール
HN:
tao
HP:
性別:
非公開
職業:
会社員
趣味:
アウトドア、自転車、ジョギング、英語学習
自己紹介:
・千葉在住のサラリーマンです。データ分析っぽいことが仕事。
・今年英検1級取得。今はTOEIC高得点を目指して勉強中。
・興味のあることは野球、アウトドア、英語学習、統計、プログラミング、PC関係などなど。
ブログ内検索
freead
順位表
プロ野球データFreak
セリーグ順位表
パリーグ順位表