question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matplotlib FigureCanvas widget

See original GitHub issue

Hi, thanks a lot for magicgui,

Usecase

I’m trying to use it to create a simple waveform generator: choose a function (e.g scipy.signal.chirp) have the corresponding magic widget, and (among maybe other things), plot the result within the widget

Attempt

In order to do that, I tried to wrap the FigureCanvas class from matplotlib.backends.backend_qt5agg, which is a QWidget instance, in a Container, which, as discussed in #314 does not seem to be feasible.

Plea

Is there an easy way to do that? Could a FigureCanvas widget be implemented in magicgui?

As matplotlib is the most used plotting backend, and magicgui already depends on it, it seems to me that this would make sense for scientific applications.

Thanks for any hint!

Best,

Guillaume

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
glygcommented, Nov 16, 2021

For completeness, a POC implementation of the waveform generator is here:

https://gist.github.com/glyg/eedb11a681bea18190e28e01ecdf38f2

1reaction
tlambert03commented, Nov 16, 2021

looks good! I’d probably use cont.native.layout() instead of cont.native.children()[0] … just in case it’s not the first child

Read more comments on GitHub >

github_iconTop Results From Across the Web

matplotlib.widgets — Matplotlib 3.6.2 documentation
Connect a callback function with an event. This should be used in lieu of figure.canvas.mpl_connect since this function stores callback ids for later...
Read more >
How can I make the FigureCanvas fill the entire Figure in a ...
I have attempted to make a GUI with embedded matplotlib widget in it. I just need the figure to be completely filled by...
Read more >
Matplotlib plots in PyQt5, embedding charts in ... - Python GUIs
The FigureCanvasQTAgg class wraps this backend and displays the resulting image on a Qt widget. The effect of this architecture is that Qt ......
Read more >
pyqt5 matplotlib - Python Tutorial - Pythonspot
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg ... We create a widget called PlotCanvas that includes the Matplotlib plot.
Read more >
Source code for pyqtgraph.widgets.MatplotlibWidget
Qt import QtGui, QtCore, QT_LIB import matplotlib if QT_LIB != ... FigureCanvasQTAgg as FigureCanvas try: from matplotlib.backends.backend_qt4agg import ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found