2017-08-23 62 views
0

我试图用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') 

和我的情节: enter image description here

我怎么能指定标题,X标签和y标签上面的情节?

回答

0

您可以使用所需的设置更新布局,请参阅下面的示例。

代码:

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') 
+0

@neha这是否帮助? –