HTML plots default to `fig-format: png`, not Quarto 1's `retina`, so plotnine plots come out at half size
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 66/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, data-visualization
Direzione di ricerca
Start with ExecuteConfig::with_defaults in engine/knitr/format.rs and trace how FigOptions::from_execute applies the figure format across engines. Compare the default environment and rendered image dimensions with the issue’s fig-format: retina reproduction and Quarto 1.9.37 behavior. Done means an unset HTML figure format produces the expected 192 png environment and full-size plotnine output.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This issue was written by Claude while adding q2 support to
Great Docs. The output shown comes from running each repro.
Bug description
For HTML, Quarto 1's default figure format is retina: its createHtmlFormat sets
execute: { fig-format: "retina" }. The kernel then sees
QUARTO_FIG_FORMAT=png and QUARTO_FIG_DPI=192, which is twice the 96 dpi. Quarto 1 writes each
PNG at half its pixel size, so a plot is sharp on a high-density screen and still 7 × 5 inches
wide.
q2's default is plain png. ExecuteConfig::with_defaults (engine/knitr/format.rs, around
line 299) sets fig_format: Some("png"), which FigOptions::from_execute uses for every engine.
So the kernel sees QUARTO_FIG_DPI=96.
plotnine can't tell png from retina in those variables, so it assumes retina and halves the
dpi (plotnine/_utils/quarto.py, in 0.15.7). It draws a 672 × 480 PNG and shows it at 336 × 240,
half the width Quarto 1 gives it. With fig-width: 4 and fig-height: 3, it's 192 × 144 rather
than 384 × 288.
Setting fig-format: retina gives the Quarto 1 result. Great Docs now sets it for q2 builds when
a site names no figure format.
Steps to reproduce
mkdir figsize && cd figsize
cat > page.qmd <<'QMD'
---
title: Figure size
jupyter: python3
---
```{python}
import os
print(os.environ["QUARTO_FIG_DPI"], os.environ["QUARTO_FIG_FORMAT"])
```
```{python}
from plotnine import ggplot, aes, geom_col
import pandas as pd
ggplot(pd.DataFrame({"x": ["a", "b"], "y": [1, 2]}), aes("x", "y")) + geom_col()
```
QMD
q2 render page.qmd
grep -o '<code>96 png\|<code>192 png' page.html
grep -o '<img[^>]*>' page.html
sips -g pixelWidth -g pixelHeight page_files/figure-html/*.png
Actual behavior
With q2 0.47.0, and with the nightly 0.48.0-nightly.20261125, the environment is 96 png, and:
<img src="page_files/figure-html/cell-2-output-1.png" alt="" width="336" height="240" />
The PNG is 672 × 480 pixels.
With fig-format: retina in the front matter, the environment is 192 png, the image is
width="672" height="480", and the PNG is 1344 × 960.
Expected behavior
As in Quarto 1.9.37, with no fig-format set: the environment is 192 png, and:
<img src="page_files/figure-html/cell-3-output-1.png" width="672" height="480" class="figure-img">
The PNG is 1344 × 960 pixels.
- Lingua principale
- Rust
- Stelle
- 316
- Fork
- 23
- Merge medio
- 11h 49m
- PR unite (30g)
- 245
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quarto-dev/q2
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Forse già presa @cscheid l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/q2#1419 ·
I maintainer di solito rispondono entro 1 giorno
-
bug testing windows
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/q2#1346 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
quarto-dev/q2#1095 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
quarto-dev/q2#1418 ·
I maintainer di solito rispondono entro 1 giorno
-
bug readers-writers windows
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
quarto-dev/q2#1416 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di quarto-dev/q2
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
BurntSushi/jiff#755 ·
I maintainer di solito rispondono entro 1 giorno
-
After the kernel is given up on, a new import leaves "Importing…" and its Cancel on the status lineApertabug help wanted priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sawhorse3d/sawhorse#163 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
MartinPTielemans/ilo#4607 ·