问题
For the following slidify deck,
---
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
```
I want to set the background color of the chart to white.
I can do this if I knit it and then edit the <style>
block in the generated figure/nvd3plot2.html
to add background-color: white;
:
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
background-color: white;
}
</style>
How do I do this from the .Rmd file?
回答1:
As indicated in my comment, a quick fix to get a white background is to add the following lines to your Rmd
file
<style>iframe{background-color: white}</style>
来源:https://stackoverflow.com/questions/21081469/set-chart-area-background-color-in-rcharts-slidify-nvd3