Lutrina
Lutrina

Reputation: 3

Matplotlib look & feel

I'm working on two computers, both of them running Windows 10. I'm pretty sure I installed the same python environment for the two of them (python3 32bits, numpy, scipy and matplotlib through pip).

They don't produce the same kind of matplotlib window (the toolbar is different, and the colormap does not seem to be the same). Here are two screenshots:

Matplotlib result 1:

result 1

Matplotlib result 2:

result 2

I guess it's a backend issue, but I can't seem to remember installing an additional backend on one of those environments. Since the picture 2 looks "GTK" to me, I still tried to install pygtk on my 2nd computer, which required me to install pygobject, which yields this compilation error:

fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory

How could I get these two matplotlib setups to look the same?

Upvotes: 0

Views: 195

Answers (1)

ImportanceOfBeingErnest
ImportanceOfBeingErnest

Reputation: 339550

You either have different versions installed, or your script uses different settings. Additionally you may have a different backend in use.

Check the version to be the same:

import matplotlib
print(matplotlib.__version__)

In case one of the version numbers is 1.x you have two options:

  1. Update case 2 to a version with 2.x.
  2. Use plt.style.use("classic") on the script run in case 1.

See changes to the default style for the differences.

Check the backend to be the same:

print(matplotlib.get_backend())

In case they aren't, you may change this via

import matplotlib
matplotlib.use("backendname")

Upvotes: 1

Related Questions