chart_Series() 是否适用于对数轴? [英] Does chart_Series() work with logarithmic axis?
问题描述
有没有办法用 chart_Series()
生成对数 y 轴?我在 quantmod
中使用实验性的 chart_Series()
而不是 chartSeries()
方法,因为在向情节.
Is there a way to produce logarithmic y-axis with chart_Series()
? I am using the experimental chart_Series()
rather than the chartSeries()
method in quantmod
, because it is more convenient when adding additional lines to the plot.
library(quantmod)
POWR <- getSymbols("POWR", auto.assign=FALSE)
# the following attempts did not produce logarithmic axis for y
chart_Series(POWR, log.scale=TRUE) # like in chartSeries()
chart_Series(POWR, log="y") # like in plot.default()
快速查看代码,似乎也无法使用现有的 chart_pars()
或 chart_theme()
方法进行自定义.
From a quick look into the code, it does not seem to be possible using existing chart_pars()
or chart_theme()
methods for customization, too.
非常感谢您的帮助.
推荐答案
如果您不需要 OHLC 图表并且关闭是您所需要的全部,您可以使用 chart.TimeSeries
函数从PerformanceAnalytics" - 包,您可以在其中使用多种选项来自定义图表.
If you don't need an OHLC chart and the Close is all you need you can use the chart.TimeSeries
function from the 'PerformanceAnalytics' - package, where you have lots of options to customize the chart.
chart.TimeSeries(cumprod(1+ ROC(POWR, type = "discrete")[-1,6]),ylog = TRUE,minor.ticks =FALSE)
这篇关于chart_Series() 是否适用于对数轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!