グラフィックパラメーターの保存と復帰

oldpar <- par(no.readonly = TRUE)

...

par(oldpar)

棒グラフ(barplot)

  • x軸目盛りラベル
    dice <- rep(1/6, 6)
    barplot(dice, ylim = c(0,0.2), names.arg = seq(1,6), axes=F)
    axis(2, at = seq(0, 0.2, 0.05))
    barp1small.jpg

ヒストグラム

  • x軸目盛りラベル追加
    kinme <- rnorm(1000, mean=50, sd=2)
    summary(kinme)
    bpoint <- seq(40, 60, 2.5)
    hist(kinme, freq = F, breaks = bpoint)
    axis(1, at = bpoint, labels = bpoint)
    hist1small.jpg
  • 確率密度分布曲線を追加
    kinme <- rnorm(10000, mean = 50, sd = 2)
    summary(kinme)
    bpoint <- seq(40, 60, 1)
    hist(kinme, freq = F, breaks = bpoint)
    axis(1, at = bpoint, labels = bpoint)
    x <- seq(min(kinme), max(kinme), (max(kinme)-min(kinme))/100)
    y <- dnorm(x, mean = 50, sd = 2)
    lines(x, y)
    hist2small.jpg

確率密度曲線

kinme <- rnorm(10000, mean = 50, sd = 2)
x <- seq(min(kinme), max(kinme), (max(kinme)-min(kinme))/100)
y <- dnorm(x, mean = 50, sd = 2)
plot(x, y, type="l", xlab="体長", ylab="確率密度", axes=F)
axis(1, at = bpoint, labels = bpoint, pos=0)
axis(2)
xseq <- seq(45, 46, 0.01)
polygon(c(xseq, rev(xseq)), 
c(rep(0, length(xseq)), dnorm(rev(xseq), mean = 50, sd = 2)), col = "red")
pdist1small.jpg

Attach file: filehist2small.jpg 522 download [Information] filebarp1small.jpg 501 download [Information] filepdist1small.jpg 520 download [Information] filehist1small.jpg 523 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2013-07-02 (Tue) 17:37:44 (1568d)