Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rmarkdown:代码块和结果的不同背景颜色(绘图)_R_R Markdown - Fatal编程技术网

Rmarkdown:代码块和结果的不同背景颜色(绘图)

Rmarkdown:代码块和结果的不同背景颜色(绘图),r,r-markdown,R,R Markdown,我正在使用prettydoc包中的architect主题并生成HTML输出。是否可能在代码块和生成的绘图之间具有不同的bg颜色,并且重要的是独立地控制这些颜色。例如,代码背景为蓝色,绘图区域背景为红色 --- output: prettydoc::html_pretty: theme: architect highlight: github math: katex --- ```{r noramlity, fig.align='center', fig.height=3} par(mf

我正在使用
prettydoc
包中的
architect
主题并生成HTML输出。是否可能在代码块和生成的绘图之间具有不同的bg颜色,并且重要的是独立地控制这些颜色。例如,代码背景为蓝色,绘图区域背景为红色

---
output:
 prettydoc::html_pretty:
 theme: architect
 highlight: github
 math: katex
---

```{r noramlity, fig.align='center', fig.height=3}
par(mfrow=c(1,2)) 
plot(density(ToothGrowth$len))
hist(ToothGrowth$len, breaks=15,col="lightblue1")
```
我可以使用css更改代码背景

```{css}
.plotColor{
  background-color:red;
}

```

```{rnoramlity, fig.align='center', fig.height=3, class.source="plotColor"}
    par(mfrow=c(1,2)) 
    plot(density(ToothGrowth$len))
    hist(ToothGrowth$len, breaks=15,col="lightblue1")
    ```
我尝试了
class.output
,但没有成功