[R] Help with Lattice--panel.axis() and a conditioning variable
Andrew Liu
Andrew.T.Liu at williams.edu
Tue Aug 3 15:52:02 CEST 2010
Hello,
I use the following code to generate this plot:
http://imgur.com/GsWvY.jpg. How do I remove the labels to the left of
the middle axis? Or is there a simpler solution that gets me the same
plot. I basically just want to highlight 25.67 on the leftmost axis, and
have all other labels black.
axis.ob <- function(side, ...){
if(side == "left"){
panel.axis(side = "left", outside = TRUE, at = ybid.at, labels =
formatC(price[ybid.at], format = "f", digits = 2),
text.col = c("black", "red"), ticks = FALSE)
}else if (side == "right"){
panel.axis(side = "right", outside = TRUE, at = yask.at, labels =
formatC(price[yask.at], format = "f", digits = 2),
text.col = c("black"), ticks = FALSE)
}else axis.default(side = side, ...)
}
barchart(price ~ size | type, data = x,
ylab = "Price", xlab = "Size (Shares)",
groups = interaction(x$status, x$time),
main = paste("Order Book", time, sep = " -- "),
stack = TRUE, sub = sub,
col = c("gray", "blue", "green", "red", "black"),
border = "transparent",
scale = list(x = list(relation = "free", at = x.at,
limits = x.limits, axs = "i", rot = 45),
y = list(alternating = 3)),
axis = axis.ob
)
Thanks,
Andrew
More information about the R-help
mailing list