Beginners difficulties making graphs

Hi. I´ve just started to work with R. (Have never written code before). Watched a bunch on youtube-tutorials, but still have some problems.

Yesterday, I managed to create a plot using

> collecteddata %>%
+   ggplot(aes(x=relTot, y=milMat, col=rel14))+
+   geom_point(alpha=0.55)+
+   geom_smooth(method = lm)

but when I do the same today, I get an ERROR-ansver, saying:

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

Could someone help me with what is wrong?
(and then, I will probably have a few more questions, that you are free to answer if time is there :blush: )

First run dev.off() and then run the code for your plot. If the problem still persists, try reinstalling ggplot2. I learnt this from here.

Without a reproducible example, it is difficult to help.

That being said, aravind's reply should fix it.