본문 바로가기
공부/R Programming

R 기초; 그래픽 - 그래프 배치

by 혼밥맨 2021. 1. 24.
반응형

R 기초; 그래픽 - 그래프 배치

 

plot(faithful, pch=19, col="blue", main="Old Faithful Geyser", sub="Yellowstone National Park", xlab="Eruption time (minutes)", ylab="waiting time (minutes)")

 

plot(pressure, type="l", col="red", main="Temperature vs. Pressure")

plot(LakeHuron, col="green", lwd=2, main="Lake Huron Level")

plot(ToothGrowth$supp, ToothGrowth$len, col="orange", main="Tooth Growth of Guinea Pig")

 

windows()

windows(width=12, height=8)

plot(faithful, pch=19, col="blue", main="Old Faithful Geyser", sub="Yellowstone National Park", xlab="Eruption time (minutes)", ylab="waiting time (minutes)")

 

par("mai")

par(mai=c(1, 0.5, 1, 0.2))

 

par("mar")

old.par <- par(mai=c(1, 0.5, 1, 0.2))

par("mai")

par(old.par)

par("mai")

 

par("mar")

old.par <- par(mar=c(5,4,4,2) + 0.2)

par("mar")

par(old.par)

par("mar")

 

 

x1 <- 1:10

y1 <- log(x1)

x2 <- 1:10

y2 <- sqrt(x2)

 

plot(x1, y1, type="l", col="red", xlab="X", ylab="Y")

lines(x2, y2, lty="dashed", col="blue")

 

range(y1)

range(y2)

 

xlim <- range(c(x1, x2))

ylim <- range(c(y1, y2))

 

plot(x1, y1, xlim=xlim, ylim=ylim, type="l", col="red", xlab="X", ylab="Y")

lines(x2, y2, lty="dashed", col="blue")

 

par("mfrow")

old.par <- par(mfrow=c(2, 2))

par("mfrow")

plot(faithful, pch=19, col="blue", main="First")

plot(pressure, pch=19, col="red", main="Second")

plot(LakeHuron, pch=19, col="green", main="Third")

plot(ToothGrowth$supp, pch=19, col="orange", main="Fourth")

 

 

반응형

댓글