Closed 2vdba2 closed 2 years ago
What do you mean by using the server directly? If you are interfacing it with the Linux console, then it is using a very limited font and most likely you can't render these special characters. Also note that it doesn't support 24 bit colors used by this library.
Have you tried using plt.show("block")
? It should be rendered properly character-wise (not color). If not, consult https://unix.stackexchange.com/q/303712
The context: I have a project of rasperbery pi like pc with screen and keyboard that works fine with python and matplotlib plots. It will run ubuntu server. (by now i am using virtualbox)
I already tried this stackexchange link (before asking here). Still plots are not rendered.
Your package works great, the problem is in the ubuntu server configuration, I will keep trying to make it work.
Well I installed all fonts present in ubuntu desktop on the ubuntu server by backup of /usr/share/fonts and sudo fc-cache -f -v
as said here https://askubuntu.com/questions/694209/how-can-i-backup-and-restore-all-installed-fonts
I still dont have a nice plot
You may try to limit output just to ASCII with the following hijacking code:
import matplotlib_terminal
import img2unicode
matplotlib_terminal.backend.optimizers['block'] = img2unicode.GammaRenderer(img2unicode.BestGammaOptimizer(charmask="ascii", use_color=False), max_h=60, max_w=180, allow_upscale=True)
(There might by typos since I'm writing this on mobile)
Then use plt.show("block")
. Otherwise I believe it would be hard to make the Linux console look good anyway.
Keep in mind that this code is in proof of concept state and converting images to those extended-set characters is computation intensive.
Also, since you have a screen and a keyboard, maybe you could just install a lightweight X server and use a regular graphical matplotlib backend?
you are right, it is computational intensive
I installed it on ubuntu server 20.04. If i connect to it by ssh on a gnome-terminal, this package works fine. Otherwise if i am directly using the server the special caracters dont appear and the result is not good. Do you have any tip to solve it?