Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simplify and fix dpi handling in tight_bbox#2621

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:masterfrompwuertz:fix_2586
Jan 30, 2014
Merged

Simplify and fix dpi handling in tight_bbox#2621

tacaswell merged 2 commits intomatplotlib:masterfrompwuertz:fix_2586
Jan 30, 2014

Conversation

pwuertz
Copy link
Contributor

Being based on PR#2588, this PR is now able to (again) fixtight_bbox.adjust_bbox handling of PGF figures.

The problem with that function is its dependence on a figure's dpi, which it naturally takes from the figure instance. This behaviour was implemented inadjust_bbox_png(). Whenadjust_bbox() is called fromFigureCanvas.print_figure() this dpi value might be incorrect, since backends like svg and pdf use a fixed value of 72dpi and override the figure dpi later when calling theirprint_() methods. The solution was to predict this setting from the file format and use the 72dpi implementation calledadjust_bbox_pdf(). This fails because the mapping from file types to backends is ambiguous.

I fixed this by moving all per-backend information fromtight_bbox.py to the backends. The code duplication inadjust_bbox() is gone. The function instead provides a parameter for setting a custom dpi, which a backend/FigureCanvas announces if necessary.

The second commit adds a missing clip rectangle in backend_pgf (reported in#2586) and an appropriate test.

@pwuertz
Copy link
ContributorAuthor

It seems that@leejjoon contributed most of the code related to the bbox feature. May I ask your opinion on this?@mdboom probably as well.

Unfortunately the master already advanced to a point where the PR isn't mergable anymore. I would like to wait for your consent for these changes before bringing them up to date again.

@pelson
Copy link
Member

👍 for this change. It doesn't merge cleanly (probably the api_changes.rst file) so will need a rebase before merging.

@leejjoon, thoughts?

@tacaswell
Copy link
Member

Do we know if these functions are used by anyone outside the library?

If they are purely private functions, should they be renamed with leading_?

@pwuertz
Copy link
ContributorAuthor

You could argue that these functions are "private enough" since they reside in a module a user normally wouldn't import, but we don't really know if someone might be using thetight_bbox module directly. I hence tried to keep the new interface at least similar to the old one.
Btw, is there a common set of rules regarding the privacy of matplotlib functions? Might be a MEP candidate..

@mdboom
Copy link
Member

👍 to a privacy MEP if anyone wants to write one. (I'm not volunteering...)

@pwuertz
Copy link
ContributorAuthor

@mdboom, so, thumbs up for this PR too ;) ?

@mdboom
Copy link
Member

Looks fine to me.@leejjoon probably understands the potential issues, better, though. If he is unavailable for comment before 1.4.0rc1, I say we merge this anyway.

tacaswell added a commit that referenced this pull requestJan 30, 2014
Simplify and fix dpi handling in tight_bbox
@tacaswelltacaswell merged commit80bba8e intomatplotlib:masterJan 30, 2014
@pwuertzpwuertz deleted the fix_2586 branchJanuary 30, 2014 06:37
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.4.0
Development

Successfully merging this pull request may close these issues.

4 participants
@pwuertz@pelson@tacaswell@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp