2016-04-05 6 views
1

Я использую subplot2grid и пытаюсь сделать fill_between() работать для второго подзаголовка.matplotlib fill_between показывает точки

Он действительно работает, но по какой-то причине он показывает оранжевые точки. Как я могу избавиться от этих точек?

Обратите внимание на оранжевые точки на втором сюжетные enter image description here

В последние 3 строки кода, где появляется fill_between(), но разместить все необходимые код для диаграммы (данные в панд dataframes)

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') 
Смежные вопросы