Skip to content

Scale docs figures to fit the screen without distortion - #12

Merged
tengjuilin merged 1 commit into
mainfrom
docs-figure-size
Oct 22, 2026
Merged

tengjuilin merged 1 commit into
mainfrom
docs-figure-size

Conversation

@tengjuilin

Copy link
Copy Markdown
Owner

Summary

  • Figures rendered at 300 dpi were displayed at 150 CSS px per inch (retina metadata), so a 10-inch figure was ~1500 px wide. The theme capped the width at the content column but kept the fixed height attribute, squishing the plot.
  • docs/conf.py: nb_render_image_options = {"scale": 64} shows figures at 96 px per inch; PNGs keep their 300 dpi pixels (~3x density).
  • docs/_static/vampire.css: cell-output images get max-width: 100%; height: auto, so they shrink to the column and keep their aspect ratio.
  • Changelog note.

Test plan

  • sphinx-build -W --keep-going passes
  • Checked in a browser at 304 px and 1440 px wide: displayed width/height ratio matches each PNG's ratio; no figure exceeds the content column

🤖 Generated with Claude Code

Retina output displayed 300 dpi figures at 150 CSS px per inch, so wide
figures overflowed the content column; the theme then capped the width but
kept the fixed height attribute, squishing them. Render images at 64 % scale
(96 px per inch) and give cell-output images max-width: 100% with
height: auto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tengjuilin
tengjuilin merged commit 20644c0 into main Oct 22, 2026
6 checks passed
@tengjuilin
tengjuilin deleted the docs-figure-size branch October 22, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant