Pandas DataFrame 步骤图: where="post" [英] Pandas DataFrame step plot: where="post"
本文介绍了Pandas DataFrame 步骤图: where="post"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何将 matplotlibs
I am wondering how I can pass matplotlibs where="post" into a pandas plot.
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randn(36, 3))
df.plot(drawstyle="steps", linewidth=2)
# this doesn't work
df.plot(drawstyle="steps", where='post')
Does anyone know how to realize this?
Thanks in advance!
解决方案
You just need to specify drawstyle="steps-post"
:
df = pd.DataFrame(np.random.randn(36, 3))
df.plot(drawstyle="steps", linewidth=2)
df.plot(drawstyle="steps-post", linewidth=2)
Compare the result:
这篇关于Pandas DataFrame 步骤图: where="post"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文