[英]Rotate y axis TEXT labels in plot.zoo
I would like to rotate the labelling of the y-labs to horizontal and can't find an answer without ggplot.我想将 y-labs 的标签旋转到水平方向,没有 ggplot 就找不到答案。
Is there a way to rotate them in plot.zoo?有没有办法在 plot.zoo 中旋转它们?
The labels I mean are those ones called Series 1:5 and I have outlined them in red.我的意思是那些称为系列 1:5 的标签,我用红色标出了它们。
data <- xts(matrix(rnorm(1000), ncol = 5), order.by = as.Date(1:200))
plot.zoo(data)
Use las=1
like this:像这样使用las=1
:
plot.zoo(data, las = 1)
The question later clarified that it was referring to the ylab.这个问题后来澄清说它指的是ylab。 plot.zoo uses mtext for that and hard codes it; plot.zoo 为此使用 mtext 并对其进行硬编码; however, we could hack it using trace
:但是,我们可以使用trace
破解它:
library(xts)
trace(plot.zoo,
quote(mtext <- function(...) graphics::mtext(..., cex = 0.7, las = 1)))
plot.zoo(data, oma = c(6, 5, 5, 0))
untrace(plot.zoo)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.