Inline images generated by RMarkdown chunk have different sized elements on different hardward

I have a RMarkdown file with a number of chunks that produce images. When I look at the inline images produced by running the chunk on my Dell XPS laptop (Windows 10, 1920x1080 screen) the images with the same font size (although lower resolution) as the equivalent image produced by ggsave():


```{r fig.width=2, fig.height=2}
tib <- tibble(x = 1:10, y = 1:10)
plt <- ggplot(tib) +
  geom_point(aes(x, y))
plt
ggsave('ggsave.pdf', width=2, height=2)
```

Windows ggsave:

Windows inline:
windows_inline

However, on my Mac desktop (Retina 5K, 27in. screen, running Catalina 10.15.7), the inline image has much smaller font.

Mac ggsave:


Mac inline:

Reducing the size of the inline image by exactly half matches the font size:


```{r fig.width=1, fig.height=1}
tib <- tibble(x = 1:10, y = 1:10)
plt <- ggplot(tib) +
  geom_point(aes(x, y))
plt
ggsave('ggsave.pdf', width=2, height=2)
```

Mac inline half-size:
mac_inline_1in

Changing fig.retina, dpi, res, and dev to different options had no effect on the font size of the inline image or the notebook preview when I tested. Since the actual plots have additional inset plots that require substantial debugging to place correctly it is important that I have consistent sizes of plot elements (I don't care about resolution as long as everything is proportionate) in the inline plots, and I would prefer to be able to use the same RMarkdown file for both computers. Is there any way to standardize the size so that the layout is proportionate on all platforms?

For the Mac:
RStudio version 1.4.1103

> R.Version()
$platform
[1] "x86_64-apple-darwin17.0"
$arch
[1] "x86_64"
$os
[1] "darwin17.0"
$system
[1] "x86_64, darwin17.0"
$status
[1] ""
$major
[1] "4"
$minor
[1] "0.3"
$year
[1] "2020"
$month
[1] "10"
$day
[1] "10"
$`svn rev`
[1] "79318"
$language
[1] "R"
$version.string
[1] "R version 4.0.3 (2020-10-10)"
$nickname
[1] "Bunny-Wunnies Freak Out"

On Windows:
RStudio - 1.3.1093

> R.Version()
$platform
[1] "x86_64-w64-mingw32"
$arch
[1] "x86_64"
$os
[1] "mingw32"
$system
[1] "x86_64, mingw32"
$status
[1] ""
$major
[1] "4"
$minor
[1] "0.3"
$year
[1] "2020"
$month
[1] "10"
$day
[1] "10"
$`svn rev`
[1] "79318"
$language
[1] "R"
$version.string
[1] "R version 4.0.3 (2020-10-10)"
$nickname
[1] "Bunny-Wunnies Freak Out"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.