I want to use the following code to draw a picture with some plot, but when I used twoord.plot, the scale of image is not as the scale imagin when using plot. Please see the following code.
rm(list=ls())
library(zoo)
library(plotrix)
library(graphics)
library(xts)
library(forecast)
x=1:100
y=rnorm(100)
z=rnorm(100)
par(mfrow=c(4,4))
plot(x,y)
twoord.plot(x,y,x,z)
How could adjust the scale in twoord.plot
? Thank you very much.
One of the possible ways to solve the problem is to use split.screen(c(4,4))
in substitution of par(mfrow=c(4,4))
and to set the mar
graphical parameter (number of lines of margin to be specified on the four sides of the plot).
library(zoo)
library(plotrix)
library(graphics)
library(xts)
library(forecast)
x <- 1:100
y <- rnorm(100)
z <- rnorm(100)
split.screen(c(4,4))
screen(1)
par(mar=c(1,2,1,1), oma=rep(0,4))
plot(x, y, xlab="", ylab="")
screen(2)
twoord.plot(x, y, x, z, mar=c(1,2,1,1))