设置图表区域的背景颜色/ slidify/nvd3

问题描述:

对于以下slidify甲板,设置图表区域的背景颜色/ slidify/nvd3

--- 
title  : Foo 
framework : revealjs  # {io2012, html5slides, shower, dzslides, ...} 
revealjs : {theme: solarized} 
highlighter : highlight.js # {highlight.js, prettify, highlight} 
hitheme  : tomorrow  # 
widgets  : []   # {mathjax, quiz, bootstrap} 
mode  : selfcontained # {standalone, draft} 
ext_widgets : [libraries/nvd3] 
--- 
## NVD3 Plot Iframe 
```{r nvd3plot2, results = 'asis', comment = NA, message = F, echo = F} 
require(rCharts) 
n1 <- nPlot(mpg ~ wt, data = mtcars, type = 'scatterChart') 
n1 
``` 

欲图表的背景颜色设置为白色。

我能做到这一点,如果我编织,然后在生成的figure/nvd3plot2.html编辑<style>块添加background-color: white;

<style> 
.rChart { 
    display: block; 
    margin-left: auto; 
    margin-right: auto; 
    width: 800px; 
    height: 400px; 
    background-color: white; 
} 
</style> 

我如何做到这一点从.Rmd文件?

+0

默认背景为白色。你想明确将其设置为白色的任何原因? – Ramnath

+0

当我在Firefox 26.0下与revealjs一起使用它时,该图表使用revealjs幻灯片为背景呈现背景颜色,而不是白色。 这意味着如果我在有着黑暗主题(比如默认主题:从上面的平台移除'revealjs:{theme:solarized}')的revealjs套牌上放置图表,我看不到图表很好,因为它是黑色背景上的黑色线条。 – jgilligan

+0

我刚刚在Chrome 31.0下进行了检查,并得到了同样的结果:默认情况下,图表不会在白色背景下呈现。我必须手动添加背景颜色:白色才能获得该行为。 – jgilligan

正如我的评论指出,速战速决得到一个白色背景是以下行添加到您的Rmd文件

<style>iframe{background-color: white}</style>