R Data Viz Example using R Base function

Create a demo dataset to be used for a plot.

# Sample data
x <- 1:50;
y <- sin(x) + x*x 

Basic plots

# type=“p”: for points (by default)
plot(x, y, type = 'p')

# type=“l”: for lines
plot(x, y, type = 'l')

# type=“b”: for both; points are connected by a line
plot(x, y, type = 'b')

# type=“o”: for both ‘overplotted’
plot(x, y, type = 'o')

# type=“h”: for ‘histogram’ like vertical lines
plot(x, y, type = 'h')

# type=“s”: for stair steps
plot(x, y, type = 's')

# type=“n”: for no plotting
plot(x, y, type = 'n')