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

Qt5 navigatonaltoolbar goes wild when vertical · Issue #16777 · matplotlib/matplotlib · GitHub

Repository navigation

Qt5 navigatonaltoolbar goes wild when vertical #16777

Closed

Description

Bug report

Bug summary
Using matplotlib.backends.backend_qt5.NavigationalToolbar2QT in vertical mode (as opposed to the default horizontal mode) makes is behave wildly when the mouse is in the graph area.

*Code for reproduction

import numpy as np
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QHBoxLayout
from matplotlib.backends.backend_qt5agg import FigureCanvas, NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure

class ChaosPlotter(QMainWindow):
    def __init__(self):
        super().__init__()
        self.main = QWidget()
        self.setCentralWidget(self.main)
        box = QHBoxLayout()
        self.main.setLayout(box)
        fig = Figure(figsize=(4, 3))
        graph = FigureCanvas(fig)
        box.addWidget(graph)
        tb = NavigationToolbar(graph, self.main)
        tb.setOrientation(Qt.Vertical)
        box.addWidget(tb)

        axes = fig.add_subplot(1, 1, 1)
        x = np.linspace(-5, 5, 100)
        y = np.sin(x)
        axes.plot(x, y)
        return

if __name__ == "__main__":
    qapp = QApplication(sys.argv)
    plotter = ChaosPlotter()
    plotter.show()
    qapp.exec()

Actual outcome
When moving the mouse over a graphed area inside the figure, the toolbar is wildly changing its size/

Expected outcome
I expected the toolbar's size to remain constant during mouse movements.

Matplotlib version

  • Operating system: Linux (Kubuntu 19.10 eoan), Linux ZVIJER-PC 5.3.0-40-generic Bugfix/legend windowcall #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Matplotlib version: 3.2.0
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.5
  • Jupyter version (if applicable): None
  • Other libraries: PyQt5

Python was installed regularly with sudo apt install python3-dev and libraries were installed with pip3

Activity

  1. InCogNiTo124 commented on Mar 15, 2020

    Author

    I presume the reason this happens is that the toolbar shows x and y coordinates which are ever changing on mouse movements. Can I somehow turn that off?

  2. tacaswell commented on Mar 15, 2020

    Member

    That does sound like the correct explanation.

    To turn them off pass coordinates=False when you create the toolbar.

  3. tacaswell commented on Mar 15, 2020

    Member

    I'm going to close this as I don't think there is anything we want to change on the Matplotlib side. Might be worth tweaking the Qt properties a bit so it behaves better in the vertical case, but I don't think we need an open issue to track that (but would merge a PR if one was opened).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL