HTML plots default to `fig-format: png`, not Quarto 1's `retina`, so plotnine plots come out at half size
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, data-visualization
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 316
- Fork
- 23
- Merge trung bình
- 11 giờ 49 phút
- Pull request đã merge (30 ngày)
- 245
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quarto-dev/q2
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Có thể đã có người làm @cscheid đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1419 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug testing windows
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
quarto-dev/q2#1346 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
quarto-dev/q2#1095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
quarto-dev/q2#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug readers-writers windows
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
quarto-dev/q2#1416 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/q2
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
BurntSushi/jiff#755 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
After the kernel is given up on, a new import leaves "Importing…" and its Cancel on the status lineĐang mởbug help wanted priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sawhorse3d/sawhorse#163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MartinPTielemans/ilo#4607 ·