我正在尝试使用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')
关于python - 使用plotly创建树状图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45847791/