Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- df = pd.DataFrame({'x':range(10)})
- df.plot(drawstyle = 'steps') # this works
- #df.plot(kind = 'area', drawstyle = 'steps') # this does not work
- # For error bands around a series df
- ax.fill_between(df.index, df - offset, df + offset, step='pre', **kwargs)
- # For filling the whole area below a function
- ax.fill_between(df.index, df, 0, step='pre', **kwargs)
- out = df.plot(kind = 'line', drawstyle = 'steps') # stepped, not filled
- stepline = out.get_lines()[0]
- print(stepline.get_data())
- df = pd.DataFrame({'x':range(10)})
- x = df.x.values
- xx = np.array([x,x])
- xx.flatten('F')
- doubled = xx.flatten('F') # NOTE! if x, y weren't the same, need a yy
- plt.fill_between(doubled[:-1], doubled[1:], label='area')
- ax = plt.gca()
- df.plot(drawstyle = 'steps', color='red', ax=ax)
- import pandas as pd
- df = pd.DataFrame({'x':range(10)})
- df.plot(kind="bar",stacked=True,width = 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement