更改gvisAnnotationChart的chartArea背景颜色

Bra*_*ani 5 r googlevis

如何更改gvisAnnotationChart的chartArea背景颜色?

我尝试过,但没有成功(我尝试复制我在这个答案中看到的内容)

gvisAnnotationChart(
...,
options = list(
    ...,
    chart = list(
      backgroundColor = "#D3D3D3"
    )
  )
)
Run Code Online (Sandbox Code Playgroud)

Kat*_*Kat 2

这是使用包演示中的一个图表,并指定背景颜色选项,以便您可以查看其记录方式。

因为它gvisAnnotationChart有侧面板、图表区域、图表和其他指定的面板类型区域,所有这些都可能有不同的背景,所以您必须真正针对这种类型的图表。

library(googleVis)
data(Stock)

plot(gvisAnnotationChart(Stock, datevar="Date",
                         numvar="Value", idvar="Device",
                         titlevar="Title", annotationvar="Annotation",
                         options=list(
                           displayAnnotations=TRUE,
                               # make it blue
                           chart = "{chartArea:{backgroundColor:'#003b70'}}",
                           legendPosition='newRow',
                           width=600, height=350)))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述