plot.xts
을 사용할 때 색상을 설정하는 해결 방법이 있습니까?plot.xts에서 색상 설정
This bug (여전히 0.8.2에 있음)은 불가능합니다. 나는 plot.zoo
을 사용할 수 있다는 것을 알고 있지만 그 버그가 보이지 않는 이래로 깨끗한 해결책이 있다면 곧 고칠 것입니다. :)
plot.xts
을 사용할 때 색상을 설정하는 해결 방법이 있습니까?plot.xts에서 색상 설정
This bug (여전히 0.8.2에 있음)은 불가능합니다. 나는 plot.zoo
을 사용할 수 있다는 것을 알고 있지만 그 버그가 보이지 않는 이래로 깨끗한 해결책이 있다면 곧 고칠 것입니다. :)
다음은 패치 된 버전입니다. xts에서 is.OHLC
을 내보내 수출해야했습니다. 부작용이 없기를 바랍니다. 나는 인자 col을 더하고 이것을 명시 적으로 plot
에게 넘겼습니다. XTS와 테스트
plot.xts2 <- function (x, y = NULL, type = "l", auto.grid = TRUE, major.ticks = "auto",
minor.ticks = TRUE, major.format = TRUE, bar.col = "grey",
candle.col = "white", ann = TRUE, axes = TRUE, col = "black", ...)
{
series.title <- deparse(substitute(x))
ep <- axTicksByTime(x, major.ticks, format = major.format)
otype <- type
if (xts:::is.OHLC(x) && type %in% c("candles", "bars")) {
x <- x[, xts:::has.OHLC(x, TRUE)]
xycoords <- list(x = .index(x), y = seq(min(x), max(x),
length.out = NROW(x)))
type <- "n"
}
else {
if (NCOL(x) > 1)
warning("only the univariate series will be plotted")
if (is.null(y))
xycoords <- xy.coords(.index(x), x[, 1])
}
plot(xycoords$x, xycoords$y, type = type, axes = FALSE, ann = FALSE,
col = col, ...)
if (auto.grid) {
abline(v = xycoords$x[ep], col = "grey", lty = 4)
grid(NA, NULL)
}
if (xts:::is.OHLC(x) && otype == "candles")
plot.ohlc.candles(x, bar.col = bar.col, candle.col = candle.col,
...)
dots <- list(...)
if (axes) {
if (minor.ticks)
axis(1, at = xycoords$x, labels = FALSE, col = "#BBBBBB",
...)
axis(1, at = xycoords$x[ep], labels = names(ep), las = 1,
lwd = 1, mgp = c(3, 2, 0), ...)
axis(2, ...)
}
box()
if (!"main" %in% names(dots))
title(main = series.title)
do.call("title", list(...))
assign(".plot.xts", recordPlot(), .GlobalEnv)
}
plot.xts2(as.xts(sample_matrix[,1]), col = "blue")
par(col="blue")
plot(yourXtsObj)
box(col="black")
par(col="black") # reset to default
는
나는이 다음 XTS 릴리스로 만드는 희망plot(yourobject.xts)
lines(yourobject.xts, col = 'blue')
을 v0.9-7! –
@DrG, 작은 갈색 새는 저 기능의 저자가 이미 문제에 대해 경고를 받았다고 말했습니다. –