似乎ggplot会插入缺失的值。如何确保在图中不插入NaN?
main_df_pl1 = main_df.copy(deep=True)
main_df_pl2 = main_df.copy(deep=True)
main_df_pl1.loc[main_df_pl1['HC146OUT_INDSTA']==0,'HC146OUT'] = np.nan
main_df_pl2.loc[main_df_pl2['HC146OUT_INDSTA']<>0,'HC146OUT_SSMAN'] = np.nan
main_df_pl2.loc[main_df_pl2['HC146OUT_INDSTA']<>0,'HC146OUT'] = np.nan
plot = ggplot(aes(x='Date', y='HC146OUT'), data=main_df_pl1)+\
geom_line(size=2, colour='steelblue')+\
geom_line(aes(x='Date', y='HC146OUT'), data=main_df_pl2, colour='black',size=1,linetype = "dotted")+\
geom_line(aes(x='Date', y='HC146OUT_SSMAN'), data=main_df_pl2, colour="#00CC33",size=3,alpha=.3)+\
geom_line(aes(x='Date', y='HC146OUT_LLINDM'), data=main_df_pl2, colour='red')+\
geom_line(aes(x='Date', y='HC146OUT_ULINDM'), data=main_df_pl2, colour='red')+\
ggtitle('HC146OUT'+' in period '+ str(StartTime)+' till '+str(EndTime))+\
xlab('Time')+\
ylab('HC146OUT')
fig = plot.draw()
ax = fig.axes[0]
ggsave("plot.png", width = 10, height = 5)