本文介绍了修改图表_系列主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 theme 参数更改条形的颜色,但出现错误:

I am trying to change the colours of the bars using the theme argument, but I get an error:

library(quantmod)
getSymbols("SPY", from=Sys.Date()-500, to=Sys.Date())
chart_Series(SPY)
chart_Series(SPY,theme=chart_theme(dn.col = "cyan"))
# Error in chart_theme(dn.col = "cyan") : unused argument (dn.col = "cyan")

推荐答案

看代码.chart_theme 没有参数,所以尝试 chart_theme(dn.col="cyan") 没有意义.

Look at the code. chart_theme takes no arguments, so trying chart_theme(dn.col="cyan") makes no sense.

> args(chart_theme)
function ()
NULL

chart_theme() 返回一个列表,您想修改其中的一部分,所以就这样做.

chart_theme() returns a list and you want to modify portions of it, so just do that.

myTheme <- chart_theme()
myTheme$col$dn.col <- "cyan"
chart_Series(SPY,theme=myTheme)

这篇关于修改图表_系列主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 07:12