Pandas DataFrame 步骤图:where="post"
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35067304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:35:01 来源:igfitidea点击:
Pandas DataFrame step plot: where="post"
提问by Cord Kaldemeyer
I am wondering how I can pass matplotlibs where="post"into a pandas plot.
我想知道如何将 matplotlibs where="post"传递到 Pandas 图中。
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!
提前致谢!
回答by CT Zhu
回答by Charlie Haley
Why not just use a matplotlib plot? Click here for an example.
为什么不直接使用 matplotlib 图?单击此处查看示例。
from matplotlib import pyplot as plt
plt.step(range(len(df.index)),df[0],where='post')
plt.step(range(len(df.index)),df[1],where='post')
plt.step(range(len(df.index)),df[2],where='post')