Mainul Quraishi Mainul Quraishi - 1 year ago 96
R Question

showing different scaling in y axis when plotting two line graph in one plot

I am trying to plot two different graph in one plot. But, the labeling in y axis is overlapping even though is the labeling is same. Here is my data-

data file 1

data file 2

I used the following code-

plot(`2000_svm_movie`,type="o",col="blue",xlab="Training Years",ylab="Performances", axes=FALSE)
par(new = TRUE)
plot(`2000_random_movie`,type="o",col="red",xlab="Training Years",ylab="Performances", axes=FALSE)

I want Y axis will be labeled like (78,79,80,81,82,83,84,85,86). How can I do this?
enter image description here

and and
Answer Source

You have to add your data, but so far I understand you want something like this?

plot(NULL, xlim=c(2007, 2014), ylim=c(78,86), xlab="Training Years", ylab="Performances")
axis(side=2, at=c(78:86), labels=c(78:86))

x1 <- c(2007:2014)
y1 <- runif(8,78,86)

lines(x1, y1, col="blue")
points(x1,y1, col="blue")

y2 <- runif(8,78,86)
lines(x1, y2, col="red")
points(x1,y2, col="red")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download