[英]blogdown not autoscaling images - they get cut off midway when viewed on iOS
---
title: "Title"
date: 2019-01-01
categories: ["TBD"]
tags: ["TBD"]
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
[EDIT] I put this at the beginning of all my *.Rmd docs and the issue is solved: [编辑]我将其放在所有* .Rmd文档的开头,问题已解决:
```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, out.width = "100%")
```
I'm running the code chunk above on my blogdown site hosted via Netlify. 我正在通过Netlify托管的Blogdown网站上运行上述代码块。 When I view it on my desktop browsers everything looks fine.
在桌面浏览器上查看时,一切看起来都很好。 When I view it on my iPhone the plots don't autoscale and get cut off.
当我在iPhone上查看时,地块不会自动缩放并被截断。
Image #1 below is my iPhone in portrait mode. 下图1是我的iPhone纵向模式。 If I rotate my iPhone to landscape mode (Image #2) I get some more horizontal resolution and the whole width of the graph is viewable.
如果将iPhone旋转到横向模式(图像#2),则可以获得更高的水平分辨率,并且可以看到整个图形的宽度。
Is there a way to get blogdown to autoscale the images so they'll work no matter the resolution of the browser in question. 有没有一种方法可以使Blogdown自动缩放图像,以便无论有问题的浏览器分辨率如何,它们都可以正常工作。 I have tested on iOS Safari/Chrome/Firefox and all browsers have the issue.
我已经在iOS Safari / Chrome / Firefox上进行了测试,并且所有浏览器都有此问题。
I also have already performed Yihui rule #1 and updated all my packages prior to asking this question via update.packages(ask = FALSE, checkBuilt = TRUE)
and tinytex::tlmgr_update()
. 在通过
update.packages(ask = FALSE, checkBuilt = TRUE)
和tinytex::tlmgr_update()
询问此问题之前,我也已经执行过Yihui规则#1并更新了我的所有软件包。
By default, the size of the plot has a fixed width in pixels. 默认情况下,绘图的大小具有固定的像素宽度。 You can specify
out.width = "90%"
in the knitr options for a responsive size. 您可以在knitr选项
out.width = "90%"
指定为响应大小。
However, even in pixels, I do not face this problem on small screens. 但是,即使是像素,在小屏幕上我也不会遇到这个问题。 Then, I think this may be related to the theme you used.
然后,我认为这可能与您使用的主题有关。 Not sure though.
虽然不确定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.