Just use a for loop:
nplot <- 3 # number of plot you want
x <- c(0:10) # x, y and z will not be different at this time
y <- c(0,1,0,0,2,2,3,3,4,4,5)
z <- c(rep(100,3), rep(200, 3), rep(300,5))
table <- cbind(x,y,z) # keep going in a table
for (i in 1:nplot){ # how many plots do you want?
if (i==1){ # if is the first case...
plot(table, type = "o") # do the plot
}
else{ # if is the second plot, third plot, ...
x <- x*1.5 # now x takes other values but y and z remains constant
table <- cbind(x,y,z) # make a new table with updated x values
plot(table, type = "o") # just plot that new values
}
}
You can save the plots with png("path/filename.png")
before every plot. After a plot is done, you must write dev.off()
just to close the png file:
nplot <- 3 # number of plot you want
x <- c(0:10) # x, y and z will not be different at this time
y <- c(0,1,0,0,2,2,3,3,4,4,5)
z <- c(rep(100,3), rep(200, 3), rep(300,5))
table <- cbind(x,y,z) # keep going in a table
for (i in 1:nplot){ # how many plots do you want?
if (i==1){ # if is the first case...
png(paste("yourpath/filename_",i,".png",sep=""))
plot(table, type = "o") # do the plot
dev.off()
}
else{ # if is the second plot, third plot, ...
x <- x*1.5 # now x takes other values but y and z remains constant
table <- cbind(x,y,z) # make a new table with updated x values
png(paste("yourpath/filename_",i,".png",sep=""))
plot(table, type = "o") # just plot that new values
dev.off()
}
}
Note that "i" in png is written to record the number of plot you're saving in order to not confuse in a future work.