FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Move pixel ratio handling into FigureCanvasBase by QuLogic · Pull Request #19126 · matplotlib/matplotlib · GitHub

Repository navigation

Move pixel ratio handling into FigureCanvasBase - #19126

Merged
QuLogic merged 1 commit into
matplotlib:masterfrom
QuLogic:hidpi-refactor
Apr 8, 2021
Merged

QuLogic merged 1 commit into
matplotlib:masterfrom
QuLogic:hidpi-refactor

Conversation

QuLogic commented Dec 16, 2020 •
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

This is already implemented in two backends (Qt5 and nbAgg), and I plan to implement it in TkAgg, so it's better to remove the repetition.

It may also be useful for external backends.

I haven't fully tested this yet (though the test suite passes), as it's waiting for #19083 and #19123.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [?] New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Comment thread lib/matplotlib/backend_bases.py Outdated

Copy link
Copy Markdown
Contributor

I wonder if this will make #18274 work better (with adjustments there as well)

QuLogic marked this pull request as ready for review December 19, 2020 06:08
Comment thread lib/matplotlib/backend_bases.py Outdated
QuLogic mentioned this pull request Dec 23, 2020
4 of 6 tasks
QuLogic force-pushed the hidpi-refactor branch 4 times, most recently from e5a840b to 3385d1a Compare December 25, 2020 00:31

QuLogic commented Dec 25, 2020

Copy link
Copy Markdown
Member Author

OK, I renamed it, and also made the setter return whether the ratio changed; it seems common in backends to do something in such cases, so that removes some code from all of them.

Comment thread lib/matplotlib/backend_bases.py Outdated
self.figure._original_dpi = self.figure.dpi
self.figure.dpi = dpi_ratio * self.figure._original_dpi
self._dpi_ratio = dpi_ratio
def handle_set_device_pixel_ratio(self, event):

anntzer Feb 10, 2021 •
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I guess these handlers are effectively private and we reserve the right to change them as we see fit with no deprecation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That's a good point, but I would say so. They're tied directly with the JavaScript side of the implementation, and I don't think we've ever guaranteed anything there.

In this case, it's only a rename for consistency's sake, so I could revert it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This will likely require a change in ipympl, but I think we should make the changes to keep the function names consistent (in this case).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I restored the handler for set_dpi_ratio, as then one can continue using an older version of ipympl with the new Matplotlib that comes out with this change.

anntzer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just one minor point about public/private API.

QuLogic added this to the v3.5.0 milestone Apr 1, 2021
QuLogic added a commit to QuLogic/ipympl that referenced this pull request Apr 6, 2021
QuLogic added a commit to QuLogic/ipympl that referenced this pull request Apr 6, 2021
QuLogic linked an issue Apr 6, 2021 that may be closed by this pull request
This is already implemented in two backends (Qt5 and nbAgg), and I plan
to implement it in TkAgg, so it's better to remove the repetition.

tacaswell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@QuLogic can merge on green.

QuLogic merged commit a61f208 into matplotlib:master Apr 8, 2021
QuLogic deleted the hidpi-refactor branch April 8, 2021 04:00
QuLogic mentioned this pull request Oct 14, 2021
3 of 4 tasks
QuLogic added a commit to QuLogic/matplotlib that referenced this pull request Oct 15, 2021
This was not originally implemented in matplotlib#19126, but causes some
inconsistencies with other backends.

This also sets the initial scale as implemented in matplotlib#18274.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull request Oct 15, 2021
This was not originally implemented in matplotlib#19126, but causes some
inconsistencies with other backends.

This also sets the initial scale as implemented in matplotlib#18274.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull request Oct 20, 2021
This was not originally implemented in matplotlib#19126, but causes some
inconsistencies with other backends.

This also sets the initial scale as implemented in matplotlib#18274.
ccaprani pushed a commit to ccaprani/matplotlib that referenced this pull request Jan 23, 2023
This was not originally implemented in matplotlib#19126, but causes some
inconsistencies with other backends.

This also sets the initial scale as implemented in matplotlib#18274.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Add HiDPI physical to logical pixel ratio property

5 participants


Back | FazBrowse Home | New Git URL