Home > database >  R markdown: reduce space between text and image
R markdown: reduce space between text and image

Time:08-09

In R markdown (output: html document), I want to insert an image between paragraphs (no text wrap). But when rendering I'm getting too large space between the paragraph and the image. I'm using the following code for that.

### Text 1
            
some more text.....
            
```{r, echo=FALSE, fig.align='top'}
library(cowplot)
ggdraw()   
   draw_image("dog.png", width = 0.5)
```
### Text 2
        
some more text...

This is how the output looks like, but as I marked in red, I want to reduce the space between the image and text. enter image description here How can I reduce/change space between them? Thanks a lot.

CodePudding user response:

Try the markdown syntax for inserting image.


### Text 1
            
some more text.....
            
![](dog.png)

### Text 2
        
some more text..

  • Related