jmitrevs / matplotlib_backend_qtquick Goto Github PK
View Code? Open in Web Editor NEWA QtQuick backend for matplotlib
License: Other
A QtQuick backend for matplotlib
License: Other
I get the following error when running the code in examples with no edits. These errors come up when ever I attempt to zoom or pan.
C:\path\to\my\project\venv\lib\site-packages\matplotlib_backend_qtquick\backend_qtquick.py:223: MatplotlibDeprecationWarning: Calling an overridden press() at pan start is deprecated since 3.3 and will be removed two minor releases later; override press_pan() instead.
FigureCanvasBase.button_press_event(self, x, y, button,
C:\path\to\my\project\venv\lib\site-packages\matplotlib_backend_qtquick\backend_qtquick.py:230: MatplotlibDeprecationWarning: Calling an overridden release() at pan stop is deprecated since 3.3 and will be removed two minor releases later; override release_pan() instead.
FigureCanvasBase.button_release_event(self, x, y, button,
C:\path\to\my\project\venv\lib\site-packages\matplotlib_backend_qtquick\backend_qtquick.py:223: MatplotlibDeprecationWarning: Calling an overridden press() at zoom start is deprecated since 3.3 and will be removed two minor releases later; override press_zoom() instead.
FigureCanvasBase.button_press_event(self, x, y, button,
C:\path\to\my\project\venv\lib\site-packages\matplotlib_backend_qtquick\backend_qtquick.py:230: MatplotlibDeprecationWarning: Calling an overridden release() at zoom stop is deprecated since 3.3 and will be removed two minor releases later; override release_zoom() instead.
FigureCanvasBase.button_release_event(self, x, y, button,
I'm using python 3.8.5 and these are the libraries and versions I have installed as reported by pip freeze
:
pip freeze
cycler==0.10.0
kiwisolver==1.3.1
matplotlib==3.3.3
matplotlib-backend-qtquick==0.0.7
numpy==1.19.3
Pillow==8.0.1
pyparsing==2.4.7
PyQt5==5.15.2
PyQt5-sip==12.8.1
python-dateutil==2.8.1
shiboken2==5.15.2
six==1.15.0
The slots don't receive signals passed from the signal in QML.
MWE:
in the examples, pass any extra argument to the slots. add print(args)
Expected Behaviour:
print whatever was passed in
Actual behaviour:
prints (), empty tuple.
Hi, I've been taking a look at this library because I need to draw a static (ie doesn't dynamically change) audio waveform in QML akin to the ones Audacity or SoundCloud would have.
However, something about the example is confusing me; you seem to be importing QtGui, QtQml, and QtCore from matplotlib_backend_qtquick.qt_compat, rather than Qt (in my case, PySide2).
I don't quite understand what this does clearly; to use this in my project, do I have to import from qt_compat instead of PySide2? If I have multiple other python files where I import PySide2 classes (such as QObject so that I can subclass a QObject), do I have to use your import here too (ie throughout the whole project)? And do I need to have PySide2 myself as well or is it already included in your project?
Oh, and also, would you say this library is performant for very large plots? I will need to be having a waveform potentially hundreds of thousands of pixels wide (though obviously I will be putting this in a ScrollView with clipping), and worry about QML's ability to hold such a large image, particularly if it's not just an image, but some form of canvas (which I assume FigureCanvas is).
Apologies if this isn't quite a proper "issue"; I would have PM'd instead because I'm not sure, but GitHub doesn't have a function like that.
First off, is the test supposed to render an interactive graph with a toolbar? I see that the DisplayBridge
class creates a NavigationToolbar2QtQuick
and passes the Canvas, but there is no toolbar in the scene. I also see that when you implement _init_toolbar
, you say to build widgets in QML. How is that done?
The test example is good to see how to render a graph but without a more thorough example or complete documentation, it is difficult to see how many aspects are intended to work.
I see that this is a very new repository so it may be inefficient to write up full documentation now so an example that makes use of many features would be helpful.
Hi. This is just a suggestion, but I have found that providing the compatibility as seen by matplotlib_backend_qtquick.qt_compat
module is more trouble than its worth. I understand that this is because you don't want to maintain two codebases one that provides a PyQt5-compatible canvas, and a PySide2 compatible one. I also understand that you don't want people to strip out the part that does the heavy lifting and not use the rest of your package, and that's really the alternative here.
It is common for people to have both PyQt5 and Pyside installed at the same time. If PyQt5 got installed as a dependency for one package, and the developer (as is common) developed a PySide2 application with only PySide2 installed, they won't have trouble related to the way in which matplotlib_backend_qtquick
chooses the backend. As a result, the compatible version of QtCore can be from PyQt5, while the rest of the application is written in PySide2. This breaks packages.
The way in which it chooses is .... not great. If I'm using your package it's likely that I assume I should import only your versions of QtCore and so on. If I only have PySide2 installed I assume that your package is written in PySide2 compatible python. I then deploy it to the client's machine and lo and behold the users get a cryptic traceback about incompatible types.
Rather than try and make the clever bit more clever, I suggest that the compatibility mode be made explicit. In lieu of importing
matplotlib_backend_qtquick.qt_compat
I suggest a different structure: matplotlib_backend_qtquick.generic
the one that guesses from the context, matplotlib_backend_qtquick.PySide2
for the PySide2 compatible versions, and matplotlib_backend_qtquick.PyQt5
for the PyQt5 respectively.
This will save developers lots of headache and be the deciding factor between using your package, or writing one based off of your source code.
I can't find the implementation of repaint method anywhere, not in the class nor in the parent classes. Can you please help?
Hello, i wan to ask for help, how can i get update on canvas based real time data ( i want to plot spectogram using microphone)
this project is very cool, but is that possible to upstream it? it will be more easy to use it from upstrem directly.
Tks,
Cong
I am getting two error actually.
The first is that app = QtGui.QGuiApplication()
wants a parameter. I know for other sources that this is usually sys.argv
so I just added that in for a test.
The second error I get is the one in the title, namely AttributeError: 'FigureCanvasQtQuickAgg' object has no attribute 'boundingRect'
from backend_qtquick.py
on line 87. I'm assuming that it is supposed to inherit boundingRect
from QtQuick.QQuickPaintedItem
but it seems to me that those don't have a boundingRect
attribute.
Do I have versions wrong?
I installed PyQt through the PyQt5 PyPi repository which gives a Qt version of 5.14.2.
My Matplotlib version is 3.2.1 as in your Readme.
My Python version is 3.7.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.