To plot graph in R, you can use plot() function.

The following method shows how you can do it with syntax.

Method: Use plot() Function

plot(x, y)

The following example shows how to plot graph in R.

Create a Graph Using plot() Function

Let’s plot graph for two columns of data frame using plot() function:

# Create data frame
df <- data.frame(Start_date=as.Date(c("2000-05-21","1998-03-28","2001-01-19","2003-04-27","2004-11-26","2008-11-25")),
                 Machine_name = c("Machine1","Machine2","Machine3","Machine4","Machine5","Machine6"),
                 Value = c(108,99,135,95,98,105),Reading= c(110,97,91,89,80,85))

# Plot graph
plot(df$Start_date, df$Reading)

# Give title to graph
title("Graph of date vs Reading")

Output:

Graph

Here the above snippet shows plot for start_date and Reading column of data frame.