Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CairoMakie behavior for figure width and dpi settings #14

Merged
merged 7 commits into from
Jan 19, 2024

Conversation

jkrumbiegel
Copy link
Collaborator

Copying a message from Slack:

the way it works in Makie 0.20 is that we mostly treat the unit in px_per_unit as the CSS px, or device independent pixel. The px in px_per_unit is then the real image pixel. When a quarto document requests some dpi which means dots per inch, or effectively pixels per inch these days, then the pixels in that is referring to real image pixels. And inch is obviously a real-world metric that doesn't change, but so is the CSS pixel, which has a fixed conversion to inches.
So, we want to convert the fig_width and fig_height which are given in inches to CSS pixels. This is done by multiplying with 96. Then these numbers should be the Makie figure size. The px_per_unit value we need to set to achieve the given dpi we can calculate similarly. 300 dots per inch == 300 / 96 dots per CSS pixel == 3.125 px_per_unit

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e950ac2) 84.48% compared to head (83bdde2) 84.21%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
- Coverage   84.48%   84.21%   -0.28%     
==========================================
  Files           5        5              
  Lines         361      361              
==========================================
- Hits          305      304       -1     
- Misses         56       57       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jkrumbiegel
Copy link
Collaborator Author

Not sure what the failures on Windows 1.6 are about

@MichaelHatherly
Copy link
Collaborator

Not sure what the failures on Windows 1.6 are about

Seen it before sometimes, intermittent issue, rerunning the failed job usually helps.

@jkrumbiegel
Copy link
Collaborator Author

Ok it went through, codecov is just one line that I don't know about. If you're ok with that you can merge.

Copy link
Collaborator

@MichaelHatherly MichaelHatherly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 😄

@MichaelHatherly MichaelHatherly merged commit e67d20d into main Jan 19, 2024
9 of 10 checks passed
@MichaelHatherly MichaelHatherly deleted the jk/makie-dpi-fix branch January 19, 2024 11:29
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.

2 participants