Does figure size in Quarto (.qmd) documents in RStudio need to be specified twice?

I use Quarto .qmd documents in RStudio. I want to see the correct-size figures in both RStudio .qmd document and in the rendered HTML document. I need to change the size of a figure in a particular cell (the figure has a non-default size). It seems that RSutdio .qmd code cell does not respond to #| fig-height: 28 syntax for inline plots (for rendered documents it behaves as expected). Is this RStudio behaviour expected for inline plots?

I tried mixing both Rmd and qmd syntax for figure size specification. So, as I understand, I have to use {r fig.width=4, fig.height=4} syntax for the correct size of inline plots and #| fig-height: 28 syntax (which is portable between different Quarto formats) for rendered plots in HTML output.

image

  1. Are my ideas correct about specification of the same parameter two times?
  2. Please, give a link to the place where this behaviour (using both syntaxes) is documented to find out about this more.
    RStudio Edition : Desktop [Open Source]
    RStudio Version : 2022.12.0.354
    OS Version      : Windows 10 x64 (build 19045)
    R Version       : R version 4.2.2 (2022-10-31 ucrt)

It shouldn't be necessary, the problem is that RStudio doesn't respect YAML-style chunk options (with a hyphen instead of a dot). This deficiency has already been reported on the GitHub repository (by a Posit employee) but has not been addressed. Comment/up-vote there to help get attention from the developers.

2 Likes

So just to be clear, currently we do have to set fig dimensions twice for each and every plot?

I think it is easier to just use rmarkdown style options once

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.