假设我们已关注DataFrame
并生成相应的图表:
import pandas as pd
import plotly
from plotly.graph_objs import Scatter
df = pd.DataFrame({"value":[10,7,0,3,8]},
index=pd.to_datetime([
"2015-01-01 00:00",
"2015-01-01 10:00",
"2015-01-01 20:00",
"2015-01-02 22:00",
"2015-01-02 23:00"]))
plotly.offline.plot({"data": [Scatter( x=df.index, y=df["value"] )]})
如果我使用以下代码:
import matplotlib.pyplot as plt
plt.step(df.index, df["value"],where="post")
plt.show()
我得到如下的步骤图:
我如何获得与step
功能相同的结果,但使用offline
plotly
代替?