#FILE NAME: plot_options.R # plot() is a high-level R function that opens a new plotting window # Here, we will show some basic options to plot() with a sequence of plots # of square root function with increasing complexity # Type ?plot to see details of basic options; you can see 657 available colores by typing colors() # Huseyin Kocak, May 25, 2016. University of Miami x = seq(from = 0, to = 10, by = 0.5) square_root_x = sqrt(x) plot(x, square_root_x) #plot x-values vs. square_root_x values with default options par(ask = TRUE) #to pause between plots plot(x, square_root_x, main = "My First Plot") # to add title plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)") #to add label to y-axis plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)", ylim = c(0, 10)) #to set limits of y-axis plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)", ylim = c(0, 10), col = "blue") #to add color plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)", ylim = c(0, 10), col = "blue", type = "o") #to over strike with both plotting characters, pch, and connecting lines plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)", ylim = c(0, 10), col = "blue", type = "o", lty = "dotted") #to set the line type plot(x, square_root_x, main = "My First Plot", ylab = "sqrt(x)", ylim = c(0, 10), col = "blue", type = "o", lty = "dotted", pch = 22) #to set plotting character