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

Bug in the HiDPI support in the qt5agg backend · Issue #8717 · matplotlib/matplotlib · GitHub

Repository navigation

Bug in the HiDPI support in the qt5agg backend #8717

Closed

Description

Bug report

Bug summary

The interactive plot window is too small, but the text remains at the size that would be correct for a larger properly sized window.

It works if you go through pyplot:

fig, ax = plt.subplots(figsize=(6,4))
ax.plot([1,2,3])

but not in this example, which uses the pure OO interface.

The version of the plot saved to the file text.pdf is correctly sized.

Code for reproduction

from matplotlib.backends.backend_qt5agg \
     import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

fig = Figure(figsize=(6, 4))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot([1, 2, 3, 2, 3, 4, 3, 4, 5])
ax.set_title('A simple plot')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
canvas.print_figure('test.pdf')
canvas.show()

Actual outcome

Expected outcome

Matplotlib version

  • Operating System: MacOS Sierra 10.12.5
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.1
  • Jupyter Version (if applicable):
  • Other Libraries:

Installed with conda (default)

Activity

  1. added this to the milestone on Jun 5, 2017
  2. tacaswell commented on Jun 5, 2017

    Member

    😞 I thought we had this sorted out.

    There is a bunch of jiggery-pokery to double the DPI under the hood. Does it help if you set the figure size after your create and add the canvas?

    attn @efiring

  3. djpine commented on Jun 5, 2017

    Author
  4. QuLogic commented on Jun 5, 2017

    Member

    The FigureCanvas sets a (non-binding) sizeHint; the FigureManager takes the hint + the toolbar size and sets the window to the correct size. I think if you want to use the canvas directly, you'll need to read the size and set it as a hard requirement, or maybe set the QSizePolicy to require the hinted size.

  5. added a commit that references this issue on Aug 7, 2017
    cfff335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL