Python 使用plotly创建树状图
我试图用plotly绘制一个树状图。我使用了下面给出的代码:Python 使用plotly创建树状图,python,plotly,Python,Plotly,我试图用plotly绘制一个树状图。我使用了下面给出的代码: import plotly.plotly as py import plotly.figure_factory as ff names = list(result_data['merchant_id']) dendro = ff.create_dendrogram(new_data,labels=names) dendro['layout'].update({'width':1400, 'height':600}) plotly.
import plotly.plotly as py
import plotly.figure_factory as ff
names = list(result_data['merchant_id'])
dendro = ff.create_dendrogram(new_data,labels=names)
dendro['layout'].update({'width':1400, 'height':600})
plotly.offline.iplot(dendro, filename='simple_dendrogram')
我得到了剧情:
如何在上面的绘图中分配标题、x标签和y标签?您只需使用所需的设置更新布局,请参阅下面的示例 代码:
import plotly.plotly as py
import plotly.figure_factory as ff
names = list(result_data['merchant_id'])
dendro = ff.create_dendrogram(new_data,labels=names)
dendro['layout'].update({'width':1400, 'height':600, 'title': 'this is the title',
'xaxis': {'title': 'xaxis label'}, 'yaxis': {'title': 'yaxis label'}})
plotly.offline.iplot(dendro, filename='simple_dendrogram')
@内哈,这有帮助吗?