I\'ve looked in different questions for a solution and I\'ve tried what was suggested but I have not found a solution to make it work.
Everytime I want to run this c
Just run graphics.off() before plotting your data. This instruction solved my error. So, it's harmless to try it before taking a more complex solution.
graphics.off()