为什么这些 Python Matplotlib 图形在不同的计算机上显示不同?

Why do these Python Matplotlib graphs display differently across different computers?

我写了一个程序来收集数据并绘制它 (y) 随着时间 (x) 的变化。我在 Windows 10 Pro 上使用 Python 3.7.7 和 matplotlib 3.2.2。我已经使用 pyinstaller 将程序编译成 .exe 并将其放在其他计算机上 运行。该程序在所有计算机上都能正常运行,但 HP i5、运行ning Windows 7 & 10 除外。 我附上了两张图的图片以帮助解释我的问题...... Good and Bad Grpah

糟糕的图表似乎偶尔显示数据,数据点之间有长水平线。我创建了一个调试版本,显示用于 x 轴和 y 轴的列表数据,列表中包含 80-110 个值,因此我知道正在收集数据。它只是没有正确显示在图表上。

我试过卸载和安装东西,我调整了任务管理器中的优先级,我试过 运行在安全模式下禁用任何可能在后台中断的扩展。

有没有人有任何想法或帮助?提前致谢!

代码片段:

def Laser_WaferScan(self, lst, display1, time_lst):
""" Laser - WAFER SCAN PLOT """
waferScan = lst
rpms = display1                 # Displays the RPMs in plt.title
waferScan_fullScan_time_lst = time_lst


#### TESTING - Moved from main() 6.1.20
if gv.bandpass_yes == True:
    plt.subplot(3, 1, 1) 
else:
    plt.subplot(2, 1, 1)
##########################################

# Dynamically setup graph axes using Plotting class
waferScan_min_ylim, waferScan_max_ylim = self.Ylim(waferScan)
plt.ylim(waferScan_min_ylim, waferScan_max_ylim)
# Compare the last value added to the waferScan_fullScan_time_lst, and if it is greater than the current X-axis limit, make it the new X-axis limit
if waferScan_fullScan_time_lst[-1] > gv.waferScan_max_xlim: 
    gv.waferScan_max_xlim = waferScan_fullScan_time_lst[-1]
plt.xlim(0, gv.waferScan_max_xlim)

if gv.scan_name != None:            # These conditional statements check to see which title should be used
    if gv.lowpass_yes == True:
        plt.title(f"{gv.scan_name}\nLowpass Filter Settings:     N: {gv.lowpass_N}     Wn: {gv.lowpass_Wn}\nRPMs = {rpms}     Time to Scan = {round(gv.adjusted_time_to_scan,4)} sec", fontsize=12)
    else:
        plt.title(f"{gv.scan_name}\nRPMs = {rpms}     Time to Scan = {round(gv.adjusted_time_to_scan,4)} sec", fontsize=12)
else: 
    if gv.lowpass_yes == True:
        plt.title(f"Lowpass Filter Settings:     N: {gv.lowpass_N}     Wn: {gv.lowpass_Wn}\nRPMs = {rpms}     Time to Scan = {round(gv.adjusted_time_to_scan,4)} sec", fontsize=12)
    else:
        plt.title(f"RPMs = {rpms}     Time to Scan = {round(gv.adjusted_time_to_scan,4)} sec", fontsize=12)
plt.ylabel("Full Wafer Scan (volts)")
plt.xlabel('Full Wafer Scan Time (milliseconds)', fontsize=10)
plt.plot(waferScan_fullScan_time_lst, waferScan, label="Laser Readings", color='k')

事实证明,会显示错误图的相关计算机安装了 McAfee Antivirus,这导致了扫描 .exe 并延迟向 matplotlib 输出数据的问题。一旦我们将 .exe 和必要的程序添加到“排除”列表中,我们就能够使图表正确显示。

从某种迂回的角度来看,我认为 McAfee 本身就是一种病毒。