Vertical top align figures of different height in Rmarkdown


I have an Rmarkdown code chunk where I want to display two external figures of different heights, and have them aligned vertically at the top. I am outputting an HTML document.

Here is the code

```{r,'hold', out.width="25%"}

This produces middle-aligned side-by-side plots (not the actual images, just used as an example).

enter image description here

However, I want these two figures top-aligned. I have tried various combinations of chunk options but I don’t find fig.align options related to vertical alignment, nor do I see options for the YAML header that manages this.

Any help would be greatly appreciated.


A quick workaround with CSS:

title: "Test"
output: html_document

img {vertical-align: top;}

```{r,'hold', out.width='25%'}

Answered By – Radovan Miletić

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.