2016-04-05 6 views
1

私はsubplot2gridを使用して、2番目のサブプロットに対してfill_between()を実行しようとしています。matplotlib fill_between点を表示

動作しますが、何らかの理由でオレンジ色の点が表示されます。どうすればこれらの点を取り除くことができますか?コードの最後の3行に

注意第二サブプロットでオレンジドットenter image description here

fill_between()が表示される場所であるが、グラフのすべての関連するコードを投稿(データはパンダのデータフレームにある)

length = len(df.index) 

fig6 = plt.figure(figsize=(14,11)) 
ax1_f6 = plt.subplot2grid((9,1),(0,0), rowspan=5, colspan=1) 
titulo = "{0} ".format(assets[0]) 
fig6.suptitle(titulo, fontsize=15, color='#0079a3') 


      # V.1) data for first subplot 
x6  = mdates.date2num(df.index[-length:].to_pydatetime()) 
y6  = df.PX_LAST[-length:].values 
z6  = df.trend_noise_thr_mean[-length:].values 
cmap = ListedColormap(['r','y','g']) 
norm = BoundaryNorm([-1.5,-1,0,1,1.5], cmap.N) 

points = np.array([x6,y6]).T.reshape(-1, 1, 2) 
segments= np.concatenate([points[:-1], points[1:]], axis=1) 

lc = LineCollection(segments, cmap=cmap, norm=norm) 
lc.set_array(z6) 
lc.set_linewidth(3) 

ax1_f6=plt.gca() 
ax1_f6.add_collection(lc) 
ax1_f6.set_xlim(x6.min(), x6.max()) 
ax1_f6.set_ylim(y6.min(), y6.max()) 
ax1_f6.xaxis.set_major_formatter(mdates.DateFormatter('%d/%m/%Y')) 

ax1_f6.plot(df.emaw.index[-length:], df.emaw[-length:], '-', lw=0.7, label='EMA', color='r') 


      # V.2) data of the second subplot 

ax2_f6  = plt.subplot2grid((9,1),(6,0), rowspan=4, colspan=1, sharex=ax1_f6) 
axb2_f6 = ax2_f6.twinx() 

test = (df.noise - df.mean) 

axb2_f6.plot_date(test.index[-length:], test[-length:], lw=1, label='test') 
axb2_f6.fill_between(test.index, test, 0, where=(test >= 0), facecolor='g', alpha=0.3, interpolate=True) 
axb2_f6.fill_between(test.index, test, 0, where=(test < 0), facecolor='r', alpha=0.3, interpolate=True) 

答えて

1

plot_dateはデフォルトでmarker='o'を使用します。マーカーをパスする=なしでドットを削除する方法:

axb2_f6.plot_date(test.index[-length:], marker=None, test[-length:], lw=1, label='test') 
関連する問題