Removing a line from a chart

Just a quick question: I'm trying to plot in R, and I told how to do it, but how to delete the line I just created? For instance:

x <- c(1, 2, 4, 5, 6.7, 7, 8, 10 )
y <- c(40, 30, 10, 20, 53, 20, 10, 5)

plot(x,y,main="X vs Y", xlab="X", ylab="Y")

lines(x,y,col="black",lty="dotted") 

This gives a good schedule. However, let's say I would like to delete the line I created earlier (or maybe the dots?), How should I do this?

+5
source share
2 answers

The trick to erasing in the R base is to redraw everything except what you want to delete in the new plot

so if you:

plot(x,y,main="X vs Y", xlab="X", ylab="Y")
lines(x,y,col="black",lty="dotted") 

then decide that you do not need a string, and then you:

plot(x,y,main="X vs Y", xlab="X", ylab="Y")

Then, if you want to erase anything, you

plot.new()
+4
source

To delete a line, you simply delete the line and restart the rest of the commands.

. , , . , , , . , , , . FYI, , , , ( , ). , , R .

(, PDF), ( Illustrator) .

+2

All Articles