在rCharts / slidify / nvd3中设置图表区域背景颜色 [英] Set chart area background color in rCharts/slidify/nvd3

查看:297
本文介绍了在rCharts / 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
```

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

I want to set the background color of the chart to white.

我可以这样做,如果我编织,然后编辑图/ nvd3plot2.html 中添加背景颜色的< style> :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>

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

How do I do this from the .Rmd file?

推荐答案

如我的意见所示,获得白色背景的快速修复是将以下行添加到您的 Rmd file

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>

这篇关于在rCharts / slidify / nvd3中设置图表区域背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆