I'm trying to switch from ioslide to xaringan. I'm not able to properly resize a ggplot image to make full screen or al least to occupy as much space as possible. I'm using both fig.height/width
and out.height/width
arguments but only one dimension change. There is a better way to resize an image?
this is the setup:
---
title: ""
author: ""
institute: ""
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: 16:9
---
#```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(fig.retina=2)
library(Cairo)
library(cairoDevice)
library(tidyverse)
library(kableExtra)
#```
---
# Plot
#```{r echo=FALSE, out.height=450, out.width= 2000}
knitr::include_graphics("img/Rplot01.svg")
#```
And this is the result:
I would like to expand the image as much as possible
You can use a markdown tag such as:
![:scale 50%](image.jpg)
see this
In Xaringan you can add images like this:
---
class: inverse, center, middle
background-image: url(img/Rplot01.svg")
background-size: contain
Please check that the info within url is correct.
As a guide you can see this presentation (the link drives you to slide number 9 where is an image) generated using this code (see line 76)
You could also use the html <img>
tag to resize and position an image in a Xaringan presentation slide.
<img src="https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg"
width="500px" height="500px"
style="position:absolute; right:10px; top:130px;">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With