我想知道是否可以将索引的名称从matplot导入到plotly中,正如我在下面尝试的那样:
Matplot 栏:
fig = plt.figure(figsize = (10, 5))
ax = fig.add_subplot(111)
pd.Series([10, 20, 30, 40, 50], index =['a', 'b', 'c', 'd', 'e']).plot.bar(ax = ax)
将 Matplot Bar 转换为 Plotly:
fig = plt.figure(figsize = (10, 5))
ax = fig.add_subplot(111)
pd.Series([10, 20, 30, 40, 50], index =['a', 'b', 'c', 'd', 'e']).plot.bar(ax = ax)
py.iplot_mpl(fig)
最佳答案
试试这个,
import plotly.plotly as py
import plotly.graph_objs as go
data = [go.Bar(
x=['a', 'b', 'c', 'd', 'e'],
y=[10, 20, 30, 40, 50]
)]
py.plot(data, filename='basic-bar')
关于python - 将 matplotlib 转换为plotly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56845502/