为什么在具有相同操作系统的两台计算机上,matplotlib图形和图标看起来会有所不同? [英] Why matplotlib graphs and icons look different on two computers with the same OS?

查看:28
本文介绍了为什么在具有相同操作系统的两台计算机上,matplotlib图形和图标看起来会有所不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两台都运行Windows XP的旧计算机,这是同一张Matplotlib图在另一张上的样子:

I have two old computers both running Windows XP and here is how the same Matplotlib graph looks like on one and on another:

#01:

#02:

唯一的区别是,计算机#01是屏幕分辨率为1280x1024的台式机,计算机#02是屏幕分辨率为1024x768的笔记本电脑.实际上,便携式计算机正在运行SP3,台式计算机正在运行SP2,但是尽管两台计算机上的色深均为32位,但便携式计算机上的窗口看起来更糟.此外,笔记本电脑运行的是 Python 2.7.13,台式机运行的是 Python 2.7.11

The only difference is computer #01 is desktop PC with screen resolution 1280x1024 and the computer #02 is laptop with screen resolution 1024x768. In fact, the laptop is running SP3 and the desktop computer is running SP2 but the window on laptop looks worse although color depth on both computers is 32 bit. Furthermore, the laptop is running Python 2.7.13 and the desktop computer is running Python 2.7.11

图形样式和图标的差异是否是因为显示分辨率和/或显示驱动程序的原因?

Could it be the difference in graph styles and icons is because of the display resolution and/or the display drivers?


通过在#02中添加 plt.style.use("classic"),图形现在看起来相同,但图标仍然不同.


By adding plt.style.use("classic") into the #02 the graphs now look the same but the icons are still different.

推荐答案

matplotlib 有两个不同输出的最明显原因当然是您安装了两个不同版本的 matplotlib.(为什么计算机会更改matplotlib输出?)

The most obvious reason for two different outputs from matplotlib is of course that you have two different versions of matplotlib installed. (Why would the computer change the matplotlib output?)

  • 第一个图像是使用matplotlib版本< = 1.5
  • 生成的
  • 第二个图像是使用matplotlib版本> = 2.0
  • 生成的

版本之间的所有差异都显示在对默认样式的更改中.

All differences between the versions are shown in Changes to the default style.

在matplotlib> = 2.0中,您可以使用 mpl.style.use('classic')命令恢复为旧样式.这不会更改工具栏上的图标,因为旧图标不会随新版本一起分发.但是,如果需要,您可以将它们从旧版本复制到新版本.

In matplotlib >= 2.0 you may use the mpl.style.use('classic') command to revert back to the old style. This will not change the icons on the toolbar since the old icons are not distributed with the newer versions. You may however copy them from the old version to the new one if that is desired.

这篇关于为什么在具有相同操作系统的两台计算机上,matplotlib图形和图标看起来会有所不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆