函数中的多个独立PyPlot

问题描述

我有两个想独立借鉴的数字。需要绘制,保存和关闭调用函数(Propagate_TLE)创建的小图形,而要打开main中的图形。当我尝试执行此操作时,对函数中图形的最后一次调用将覆盖main中的图形。如何创建互不冲突的独立图形?

    def propagate_TLE(sat_tle,ID):

            plt.figure(figsize=(6,5))
            ax = plt.subplot(111,projection='polar')

            ax.scatter(sat_az,sat_alt,marker ='o',color ='blue')

            plt.savefig((str(ID)).strip()+'_visibility.png')
            plt.close

    def main(): 

        fig,ax1 = plt.subplots()
        ax1.set_title('Schedule')

        #Do the business of incrementing time and outputting positions for each satellite
        for satellite in Sat_dict.keys():
            colors,time_unit,ID = propagate_TLE(Sat_dict[satellite],satellite)
            #create a bar-like graph of the satellite schedule
            ID = [ ID for i in range(round(total_propagation))]
            ax1.scatter(time_unit,ID,color=colors,marker='s')

        plt.savefig('Satellite_schedule.png')
    return

请原谅我没有包含无关的代码。我怀疑有一种建立数字的方法,这样它们就不会冲突。在上面,我结束了在Propagate_TLE中为“ Satellite_schedule.png”创建的最后一个极坐标图。任何帮助将不胜感激!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)