Created
September 23, 2016 04:01
-
-
Save masayukeeeee/7e8cb9271296e7155e740a81e46e4b37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
png(file="001_sample.png",width=500, height=500) | |
par(mfrow=c(1,1), family="HiraKakuProN-W3") | |
plot(10,10,type="n", ylim=c(0,12), xlim=c(-100,100), yaxt="n", ylab="") | |
abline(h=12) | |
abline(h=9) | |
for(i in seq(-80,98)){ | |
lines(c(i,i+2), c(12,9), lwd=0.3) | |
} | |
abline(h=8, col="blue") | |
abline(h=5, col="blue") | |
for(i in seq(-30,10,0.1)){ | |
lines(c(i,i^2), c(8,5), col="blue", lwd=0.3) | |
} | |
abline(h=4, col="red") | |
abline(h=1, col="red") | |
for(i in seq(-10,10,0.1)){ | |
lines(c(i,i^3), c(4,1), col="red", lwd=0.3) | |
} | |
abline(v=0, col="red", lty="dashed") | |
legend("topleft", legend=c("1次関数","2次関数","3次関数"), col=c("black","blue","red"), lty=c(1,1,1), bg="white") | |
dev.off() | |
png(file="002_sample.png",width=500, height=500) | |
par(mfrow=c(1,1), family="HiraKakuProN-W3") | |
plot(1,1,type="n", ylim=c(-100,100),xlim=c(-20,20)) | |
abline(a=1, b=2, lwd=3) | |
x <- seq(-20,20, 0.1) | |
lines(x, x^2, lwd=3, col="blue") | |
lines(x, x^3, lwd=3, col="red") | |
legend("topleft", legend=c("1次関数","2次関数","3次関数"), col=c("black","blue","red"), lty=c(1,1,1), bg="white") | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment