# Error in R: plot.new has not been called yet (2 Examples)

In this R tutorial you’ll learn how to solve the error “plot.new has not been called yet”.

## Example 1: Replicating the Error Message: plot.new has not been called yet

lines(c(3, 1, 8, 8, 5)) # Adding lines to non-existent graph (Error) # Error in plot.xy(xy.coords(x, y), type = type, ...) : # plot.new has not been called yet |

lines(c(3, 1, 8, 8, 5)) # Adding lines to non-existent graph (Error) # Error in plot.xy(xy.coords(x, y), type = type, ...) : # plot.new has not been called yet

## Example 2: Solving the Error Message: plot.new has not been called yet

plot(seq(0, 8, 2)) # Drawing graph in R lines(c(3, 1, 8, 8, 5)) # Adding lines to graph |

plot(seq(0, 8, 2)) # Drawing graph in R lines(c(3, 1, 8, 8, 5)) # Adding lines to graph