在rCharts / slidify / nvd3中设置图表区域背景颜色

时间:2014-01-12 23:04:28

标签: css nvd3.js rcharts slidify

对于以下的滑动套牌,

---
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
```

我想将图表的背景颜色设置为白色。

如果我编织它然后编辑生成的<style>中的figure/nvd3plot2.html块以添加background-color: white;,我就可以执行此操作:

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

如何从.Rmd文件中执行此操作?

1 个答案:

答案 0 :(得分:2)

正如我的评论所示,获得白色背景的快速解决方法是将以下行添加到Rmd文件中

<style>iframe{background-color: white}</style>
相关问题