微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决为什么这些Python Matplotlib图在不同的计算机上显示不同?

我编写了一个程序,该程序收集数据并将其绘制为(y)随时间(x)的变化。我在Windows 10 Pro上将Python 3.7.7与matplotlib 3.2.2结合使用。我已经使用pyinstaller将程序编译为.exe,并将其放在其他计算机上运行。该程序已在运行Windows 7和10的所有计算机上正常运行,但HP i5除外。 我附上了两个图表的图片,以帮助解释我的问题... 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)
##########################################

# 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,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,fontsize=12)
    else:
        plt.title(f"RPMs = {rpms}     Time to Scan = {round(gv.adjusted_time_to_scan,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和必要的程序添加到“排除”列表后,便可以使图形正确显示。

以某种round回的方式,我认为McAfee本身就是病毒。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。