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

🐛 Adjusting the savefig to adjust the stroke in the case of pdf. Also, adding tests for savefig. #73

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

davibarreira
Copy link
Owner

Inside the savefigs.jl:

    img = string(drawsvg(plt; height=height, pad=pad))
    # Extract viewBox height from SVG string
    viewbox_match = match(r"viewBox=\"[^\"]*\s+[^\"]*\s+[^\"]*\s+([^\"]*)", img)
    viewbox_height = parse(Float64, viewbox_match[1])

    # Recompute the height to fix the stroke width
    img = string(drawsvg(U(300/viewbox_height) * plt; height=height, pad=pad))

This is an imperfect solution, but it solves the problem. What this does is to adjust the diagram size to the viewbox size by multiplying the diagram plt by U(300/viewbox_height).

A future change to the package will adjust the way it treats strokes in order to avoid having to use this fix.

Copy link

codecov bot commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.56%. Comparing base (50228ba) to head (7e36da0).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/backends/savefigs.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   72.57%   73.56%   +0.98%     
==========================================
  Files          71       71              
  Lines        2498     2504       +6     
==========================================
+ Hits         1813     1842      +29     
+ Misses        685      662      -23     

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

@davibarreira davibarreira merged commit 9ef7bab into master Feb 20, 2025
5 checks passed
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