How can I change the backend of the matplotlib library module without matplotlib.use()? - matplotlib

How can I change the backend of the matplotlib library module without this?:
matplotlib.use()
I used to have a tkinter backend by default, and now, after installing pyqt5, the pyqt5 backend is used by default.I want tkinter to be used in backend,because even if I use:
matplotlib.get_backend("TkAgg")
the matplotlib graphic icon is blurry.

Related

Convert a Python application which uses PyQt5 to WebAssembly

Is there any way to convert a python application which uses PyQt5 to WebAssembly? Or I must use the html components to render UI?

Toolbar icon for matplotlib not showing

The matplotlib toolbar icon doesn't show up with figure windows as highlighted in the red circles.
I am on the Qt5Agg backend and when I switch to TkAgg, the tk icon shows up.
The reason I am curious was that it was working fine until a few days ago but updating some packages broke it.
On Anaconda 5.2.0, matplotlib 2.2.3 and the image is attached.
https://i.stack.imgur.com/0p5cv.png

Kivy garden matplotlib buildozer

I have an app which was successfully packaged for android using python 2 and buildozer. I ammended the program adding the matplotlib garden module using 'garden install --app matplotlib' into the main app directory. It runs fine on pydroid and ubuntu, but crashes after packaging on android. I've added regular matplotlib python library to requirements in .spec file and tried putting matplotlib into the garden requirements also. Should I not add the garden matplotlib to kivy garden requirements in spec file if the garden module is already installed in the main app dir? Thanks.
I had this same problem and would have dropped kivy altogether, until I caught the workaround described here on github. It's also referenced in comments on this answer here on stackoverflow. As I saw it, the crash occurred due to the statement from kivy.garden.matplotlib import FigureCanvasKivyAgg, and the problem isn't obvious from any of the messages in the android logfiles.

Google map does not display correctly in jupyter notebook

I'm trying to use google map API to visualize some data in jupyter notebook. Here is the code I used to display basic map in jupyter:
import gmaps
import os
import json
import gmaps.datasets
gmaps.configure(api_key="AIz....")
fig=gmaps.figure()
fig
After I ran the code, nothing was displayed. I used my own google API key and couldn't figure out why the map isn't displayed. I'm new to the geojson field, so any idea or thoughts is appreciated.
Did you make sure Widgets are enabled in your jupyter? try this before you run Jupyter:
jupyter nbextension enable --py gmaps
jupyter nbextension enable --py widgetsnbextension
If you are using JupyterLab you can check out the steps in the documentation here
JupyterLab Documentation

How to use camera with python in windows

I am trying to use a camera in windows. I ve installed python with anaconda. tried installing pygame with conda but did not work so installed with pip.
Following the advice in open camera with pygame I tried to open the camera but I got an error.
When executing pygame.camera.init() the system complains that can not import name _camera .
Indeed when reading camera.py there is the line from pygame import _camera and this is where it fails. It can not import _camera
I am at lost at what to do. Any help very much appreciated
EDIT1:
I have been told that this works in linux only. :(
So going to the title question: How to use the camera with python in windows? (or mac?)
PyGame Doc: camera
Pygame currently supports only Linux and v4l2 cameras.
It means it works only with Linux.