如何在Rmarkdown中实现带超链接的图片每块2张的排版需求?
实现flexdashboard单块放置2张并排图片的两种方案
方案1:HTML+CSS Flex布局(自定义程度高,可保留跳转、自定义标题样式)
直接替换你现有代码中的HTML部分即可,使用Flex布局自动完成并排排版,避免原来inline-block的对齐异常问题:
``` --- ## 方案2:Knitr原生参数实现(代码更简洁,适合不需要复杂自定义的场景) 不需要写HTML代码,直接通过knitr的chunk参数控制图片排版,更符合R Markdown的使用习惯: ```r --- title: "Landing Page" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill runtime: shiny --- ```{r setup, include=FALSE} library(flexdashboard) library(shiny) library(knitr) ```--- title: "Landing Page" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill runtime: shiny --- ```{r setup, include=FALSE} library(flexdashboard) library(shiny)
# 替换为你的两张图片地址即可,本地路径或在线地址都支持 include_graphics(c( "https://www.idashboards.com/wp-content/uploads/2020/06/IT-Service-Desk.png", "你的第二张图片地址" ))
--- ### 方案选择说明 - 需要自定义标题样式、点击跳转功能选方案1 - 仅需快速实现并排图片展示选方案2 内容的提问来源于stack exchange,提问作者RL_Pug
相关产品推荐
相关产品推荐

