R ggplot Error in .Call.graphics(C_palette2, .Call(C_palette2, NULL)): invalid graphics state

We ran ggplot in R and Error in.call.graphics (C_palette2,.call (C_palette2, NULL)) : invalid graphics State prompt:
Just execute the dev.off() command and reexecute the ggplot command

Read More: