Hi, I wanted to plot 2 lines on a single graph. Each graph has one axis that can be common. The code that I'm using is:
------------------------------------------------------- par(mfrow=c(1, 1)) x1 <- c(2, 4, 6, 8, 10, 12) x2 <- c(10, 20, 30, 40, 50, 60) y1 <- c(10,12,15,22,34,21) y2 <- c(40, 130, 150, 145, 40, 30) par(las=1, mar=c(4, 4, 2, 4)) plot.new() #plot.window(range(x1), c(0, 12)) plot.window(range(x2), c(0, 170)) plot.window lines(x1, y1) lines(x2, y2) points(x1, y1, pch=16, cex=2) points(x2, y2, pch=21, bg="white", cex=2) par(col="grey50", fg="grey50", col.axis="grey50") axis(1, at=seq(0, 16, 4)) axis(2, at=seq(0, 170, 10)) axis(3, at=seq(0, 70, 10)) axis(4, at=seq(0, 170, 10)) box(bty="u") mtext("k", side=1, line=2, cex=0.8) mtext("GO terms", side=2, line=2, las=0, cex=0.8) mtext("Num clusters", side=3, line=2, las=0, cex=0.8) mtext("GO terms", side=4, line=2, las=0, cex=0.8) par(mar=c(5.1, 4.1, 4.1, 2.1), col="black", fg="black", col.axis="black") --------------------------------------------------- One of the lines comes out alright, but the other doesn't ( one x axis doesn't come out right either). Is there any way I can stretch one of the x axis so that it shows the range 0-16 spread over the entire axis? Hopefully, that should take care of the line problem too. Any help would be appreciated. thanks! __________________________________________________ [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.