html - 如何在 Xaringan 演示文稿中调整图像大小?

标签 html css r r-markdown xaringan

我正在尝试从 ioslide 切换到 xaringan。我无法正确调整 ggplot 图像的大小以制作全屏或至少占据尽可能多的空间。我同时使用了 fig.height/widthout.height/width 参数,但只改变了一个维度。有没有更好的方法来调整图像的大小? 这是设置:

---
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")
#```

结果是这样的: enter image description here

我想尽可能地扩大图像

最佳答案

设置图片大小

您可以使用 Markdown 标签,例如:

![:scale 50%](image.jpg)

参见 this

作为背景图片:

在 Xaringan 中,您可以像这样添加图像:

---
class: inverse, center, middle
background-image: url(img/Rplot01.svg)
background-size: contain

请检查url中的信息是否正确。

作为指南,您可以查看 this presentation (该链接将带您前往第 9 号幻灯片,其中有一张图片)使用 this code 生成(见第 76 行)

关于html - 如何在 Xaringan 演示文稿中调整图像大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58581418/

相关文章:

html - TreeView 展开折叠功能?

javascript - 标题下方的标签在使用 javascript 再次单击时消失,不知道为什么

r - 将语料库用作字典时 stemCompletion() 函数输出错误

r - 使用 purrr 来捕获 mapply 的错误

r - 如何在 R 中让作业在后台运行

php - 在最小化/最大化期间滑动图像对齐变化

javascript - 使用 Chartjs 在数据中创建数据

php - 滚动条区域在 Chrome 中只是蓝色的

css - 如何在 select2 选项中垂直居中图标?

image - 如何使用 CSS3 设置 img 样式