# ------------------------------------------------------------------
# File name: saving_to_file.R
#
# Saving the plot of square root function to a png file
# You can also save a picture as a pdf file by using the
# pdf() function with .pdf file extension
#
# The file is saved in the current working directory of R
# Existing file with same name is overwritten
# The graph will not be output to the screen, so you should save
# after you get the desired picture
#
# Version: 2.1
# Authors: H. Kocak, University of Miami and B. Koc, Stetson University
# References:
# https://www.r-project.org
# ------------------------------------------------------------------
png("square_root_function.png", bg = "gray", width = 600, height = 600)
x = seq(from = 0, to = 10, by = 0.5)
square_root_x = sqrt(x)
plot(x, square_root_x, main ="Graph of Square root function", xlim = c(0, 10), ylim = c(0, 10),
col = "red", type = "o")
dev.off()