def plot_tree(self, depth=3): from pyecharts import TreeMap data = self.describe_tree(self.tree_) tree_map = TreeMap(self.name, "", width=800, height=500) tree_map.use_theme("dark") tree_map.add(self.name, data, is_label_show=True, label_pos='inside', treemap_left_depth=depth) return tree_map
num += 1 else: continue dom2.append(num) def message(): for k in range(len(dom2)): data = {} data['name'] = dom1[k] + ' ' + str(dom2[k]) data['value'] = dom2[k] yield data data1 = message() dom3 = [] for item in data1: dom3.append(item) treemap = TreeMap("拉勾网数据分析岗—技能图", title_pos='center', title_top='5', width=1200, height=600) treemap.use_theme("wonderland") treemap.add('数据分析技能', dom3, is_label_show=True, label_pos='inside', is_legend_show=False) treemap.render('拉勾网数据分析岗—技能图.html')