It turns out that setting plot sizes on a Mac with retina display can be challenging. I am not referring to file sizes or resolutions that can be taken care of with the fig.retina setting (I have seen several questions about that), but the fact that the actual figure layout differs between the inline version of a an RMarkdown script and both an exported version with the same dimensions (using ggsave) as well as a knitted version. Even small figure dimensions appear gigantic inline on the screen while they export and knit correctly. So, the ratio between font size and "plot size" (or whatever it would be called) appears to change. If I run the code on an older (non-retina) Macbook or a PC, the inline figure sizes are as expected.
This is an example of what I mean. The specified figure dimensions were fig.width=4, fig.height=3.
Is there a way to get the inline graph dimensions match the knitted versions...?
Thanks y'all!
edit: code included, not sure how reproducible it is though, since it might only be relevant to users with retina or 4k displays:
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
```{r, fig.width=4, fig.height=3}
Pdata <- data.frame("X" = 1:10, "Y" = 1:10) # some data
ggplot(data = Pdata,aes(x = X,y = Y)) +
geom_point() +
theme_bw(base_size = 20) +
labs(x = "Some stuff", y = "Some more stuff")
```

grDevices::dev.size()can help?