Idea: Matplotlib Backend Mode
See original GitHub issueHi! I found this library and it’s very interesting. Thanks for the great library.
One immediate thought I have is that its programmatic interface is quite independent. I wish I would be able to use the same matplotlib code for drawing plots, so implementing a matplotlib backend or (some sort of wrapper) would be great.
The API showcased in https://github.com/piccolomo/plotext/blob/master/readme/subplots.md follows the legacy plt.
matplotlib API, which I think is bad and should be discouraged.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Backends — Matplotlib 3.6.2 documentation
Without a backend explicitly set, Matplotlib automatically detects a usable backend based on what is available on your system and on whether a...
Read more >Matplotlib doesn't show plots in new window
Hi All, Setup: Ubuntu 18.04, Pycharm 2019.2 pro, python 3.6.8, ... You can try different matplotlib backends (backends are switched in the ...
Read more >Matplotlib is currently using agg, which is a non-GUI backend ...
Solution 1: is to install the GUI backend tk. I found a solution to my problem (thanks to the help of ImportanceOfBeingErnest).
Read more >Matplotlib: Interactive and Non-Interactive Use
matplotlib has the concept of backends — essentially the target canvas or surface it can render a figure to. A backend implementation takes ......
Read more >Using matplotlib in a python shell - omz:software
ipython also turns on interactive mode for you, which causes every pyplot command to trigger a figure update, and also provides a matplotlib...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @wookayin,
I have worked on your request and added the function
from_matplotlib()
function, in the new version 5.1, available only on GitHub for now, using:The function is described here and you have been credited here.
Any feedback or double test is appreciated 😃.
Thanks and all the best, Savino
I looked a bit into how this could be realized, and a tentative conclusion is due to much design differences this would not be easily possible.
The matplotlib backend API requires implementation of figure manager (which is straightforward) and renderer. The renderer is supposed to draw graphics being rendered from matplotlib-internal data structures (such as Figure, SubplotAxes). Mostly the renderer would need to implement how to draw path, image, and text, but the current implementation of plotext has nothing to do with matplotlib internal APIs and has their own replication of similar concepts. So writing an adapter or bridge is not straightforward (unless a huge refactoring and modularization happens); this library is designed to do simple plotting jobs based on its own interface and internal data structures (seemingly similar but different a lot), and the core implementation of TUI drawing is strongly coupled with those APIs which are not compatible with matplotlib.
I will close this issue for now, but if you have any other thoughts I’d be happy to discuss more.