Andrew Liu
2010-Aug-03 13:52 UTC
[R] Help with Lattice--panel.axis() and a conditioning variable
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