I'm trying to overlay plots of the price action between the bid and the ask on intraday. I have a piece of data that's normalized to micro-returns [i.e., the bounce back from the bid and the ask during the day.]
How do i get the plot to keep the same x and y dimensions from the previous plot automatically, without precalculating an xlim and ylim variable?
Here's plot 1, from running this:
> plot( log( rets$V4[2:l] / rets$V4[1
l-1)] )[1:100], type="l" )
<img src="http://media.chartvibe.com/etimg/retv4_1.jpg">
Here's plot 2:
> plot( log( rets$V5[2:l] / rets$V5[1
l-1)] )[1:100], type="l", col="blue" )
<img src="http://media.chartvibe.com/etimg/retv5_1.jpg">
Now, if I try something like this:
plot( log( rets$V4[2:l] / rets$V4[1
l-1)] )[1:100], type="l" )
plotparams <- par( no.readonly = TRUE )
plotparams$new=T
par( plotparams )
plot( log( rets$V5[2:l] / rets$V5[1
l-1)] )[1:100], type="l", col="blue" )
I'll get something like this:
<img src="http://media.chartvibe.com/etimg/combined.jpg">
But what I want, is this (even though I manually compute this stuff), is something that gets created by this code:
# slice off 1:100 for the ET post
l <- length( rets$V4 )
logret4 <- log( rets$V4[2: l] / rets$V4[1
l-1)] )[1:100]
logret5 <- log( rets$V5[2: l] / rets$V5[1
l-1)] )[1:100]
ydm <- c( min( logret4, logret5 ), max( logret4, logret5 ) )
xdm <- c( 0, 100 )
plot( logret4 , type="l", col="red", ylab="y", xlab="x", ylim=ydm, xlim=xdm )
par( new=T )
plot( logret5, type="l", col="blue", ylab="y", xlab="x", ylim=ydm, xlim=xdm )
<img src="http://media.chartvibe.com/etimg/combined_smooth.jpg">
How do I get R to cleanly carry over the underlying plot parameters and have plot() actually work with it? This drives me nuts every time, but I end up re-coding it every time. It's driving me bat5hi7 crazy. There should be a slick way to overlay the plot and preserve the dimensions as is.
How do i get the plot to keep the same x and y dimensions from the previous plot automatically, without precalculating an xlim and ylim variable?
Here's plot 1, from running this:
> plot( log( rets$V4[2:l] / rets$V4[1
<img src="http://media.chartvibe.com/etimg/retv4_1.jpg">
Here's plot 2:
> plot( log( rets$V5[2:l] / rets$V5[1
<img src="http://media.chartvibe.com/etimg/retv5_1.jpg">
Now, if I try something like this:
plot( log( rets$V4[2:l] / rets$V4[1
plotparams <- par( no.readonly = TRUE )
plotparams$new=T
par( plotparams )
plot( log( rets$V5[2:l] / rets$V5[1
I'll get something like this:
<img src="http://media.chartvibe.com/etimg/combined.jpg">
But what I want, is this (even though I manually compute this stuff), is something that gets created by this code:
# slice off 1:100 for the ET post
l <- length( rets$V4 )
logret4 <- log( rets$V4[2: l] / rets$V4[1
logret5 <- log( rets$V5[2: l] / rets$V5[1
ydm <- c( min( logret4, logret5 ), max( logret4, logret5 ) )
xdm <- c( 0, 100 )
plot( logret4 , type="l", col="red", ylab="y", xlab="x", ylim=ydm, xlim=xdm )
par( new=T )
plot( logret5, type="l", col="blue", ylab="y", xlab="x", ylim=ydm, xlim=xdm )
<img src="http://media.chartvibe.com/etimg/combined_smooth.jpg">
How do I get R to cleanly carry over the underlying plot parameters and have plot() actually work with it? This drives me nuts every time, but I end up re-coding it every time. It's driving me bat5hi7 crazy. There should be a slick way to overlay the plot and preserve the dimensions as is.