Prevent line smoothing in vicent area chart

107 views Asked by At

I'm plotting a pandas dataframe using python vincent. For each subsequent period, a new group is added, which vincent handles nicely but matplotlib does not. The automatic smoothing in vincent, however, is causing the curves to extend out where data should not exist. Here is the vincent chart:

vincent.StackedArea(granite)

enter image description here

With a bit of manipulation in pandas, I can get the desired graph in matplotlib. How can I get this output in vincent?

granite2 = granite.cumsum(axis=1)
index = granite2.index.values
slant = granite2.fillna(method="ffill", axis=1, limit=1)
plt.fill_between(index, 0, granite2[index[0]].values)
for i in range(0,len(index)-1):
    plt.fill_between(index[i:], granite2[index[i]].values, slant[index[i+1]].values)

enter image description here

0

There are 0 answers