How to fix: "Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created." warning

This can be solved by updating matplotlib to the latest version. First, remove the older version using:

pip uninstall matplotlib

Then, install the latest version using:

pip install matplotlib

in QT you have some rules when setting application flags, and that is one of them,

you need to do something like (c++ as ref but in python is the same):

//first set the flags
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
//more code and then create the QApplication 
QApplication mainApplication(argc, argv);