简体   繁体   中英

On plotting in HTML5 slides with knitr

Here is my problematic slide:

在此处输入图片说明

The plain text for this slide is

# Title
```{r plot, echo=FALSE}
library("ggplot2")
x <- seq(-1,1,0.05)
y <- x^3/3-x^2 + rnorm(41,sd=0.1)
qplot(x,y)+geom_smooth()
```
- item 1
- item 2

And I want to:

  1. Hide the comment text (## blahblah)
  2. Hide the text "plot of chunk plot"
  3. Make the plot smaller, so that the items can be shown

Could you please give me some hints? Thank you.

You should take time to read the wonderful documentation provided for knitr .

Without knowing your work flow to create the slides it is hard answer from the html5 end.

You are looking for fig.width , fig.height , fig.cap , warning and message from the knitr chunk options.

```{r plot, echo=FALSE,fig.width = 3, fig.height = 3,  fig.cap = '', warning = FALSE, message = FALSE, cache = FALSE}
library("ggplot2")
x <- seq(-1,1,0.05)
y <- x^3/3-x^2 + rnorm(41,sd=0.1)
qplot(x,y)+geom_smooth()
```
- item 1
- item 2

You will have to adjust the height and width to get the size that is suitable for slides

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM