如何解决函数中的多个独立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 举报,一经查实,本站将立刻删除。