def t3(pa): hm = p.HeatMap('地区职位与需求关系', width=1500, height=600) hm.add("需求量", next(pa), next(pa), next(pa), is_visualmap=True, visual_range=[350, 25000], visual_text_color="#000", visual_orient='horizontal', yaxis_label_textsize=8, yaxis_rotate=-45, is_toolbox_show=False) return hm
def confusion_matrix_map(y_true, y_pred, jupyter=True, path="Confusion Matrix Map.html"): t = confusion_matrix(y_true, y_pred) t = pd.DataFrame([[i, m, n] for i, j in t.to_dict().items() for m, n in j.items()], columns=['actual', 'predict', 'over_values']) heatmap = pe.HeatMap("Confusion Matrix Map") heatmap.add("Confusion Matrix", t.drop_duplicates(['actual']).actual.values, t.drop_duplicates(['predict']).predict.values, t.values, is_visualmap=True, xaxis_name='Actual', yaxis_name='Predict', visual_text_color="#000", visual_orient="horizontal", visual_range=[0, t.over_values.max()]) return heatmap if jupyter else heatmap.render(path)
def creat_Heatmap(): x_axis = [ "12a", "1a", "2a", "3a", "4a", "5a", "6a", "7a", "8a", "9a", "10a", "11a", "12p", "1p", "2p", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p", "11p" ] y_aixs = [ "Saturday", "Friday", "Thursday", "Wednesday", "Tuesday", "Monday", "Sunday" ] data = [[i, j, random.randint(0, 50)] for i in range(24) for j in range(7)] heatmap = pyecharts.HeatMap() heatmap.add("热力图直角坐标系", x_axis, y_aixs, data, is_visualmap=True, visual_text_color="#000", visual_orient='horizontal') # heatmap.render('Heatmap-weather.html') page.add(heatmap)
top_kw_percentage_df[i] = pd.Series(list(kw['percentage']), index=kw['kw']) top_kw_percentage_df.fillna(0, inplace=True) top_kw_percentage_df.to_csv('top_kw_percentage_df.csv') data = [] i = 0 for index in top_kw_percentage_df.index: j = 0 for score in top_kw_percentage_df.columns: data.append([j, i, top_kw_percentage_df[score][index] * 100]) j += 1 i += 1 # 创建热力图展示结果 heatmap = pec.HeatMap() heatmap.add("", top_kw_percentage_df.columns, top_kw_percentage_df.index, data, is_visualmap=True, visual_text_color='#000', visual_range=[0, 10], visual_orient='horizontal') heatmap.render(path='top_heatmap.html') # 创建柱状图展示结果 bar3d = pec.Bar3D("3D 柱状图示例", width=1200, height=600) range_color = [ '#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'
"12a", "1a", "2a", "3a", "4a", "5a", "6a", "7a", "8a", "9a", "10a", "11a", "12p", "1p", "2p", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p", "11p", ] y_axis = [ "Saturday", "Friday", "Thursday", "Wednesday", "Tuesday", "Monday", "Sunday", ] data = [[i, j, random.randint(0, 50)] for i in range(24) for j in range(7)] heatmap = echarts.HeatMap("热力图示例") heatmap.add( "热力图直角坐标系", x_axis, y_axis, data, is_visualmap=True, visual_top="45%", visual_text_color="#000", visual_orient="horizontal", ) attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] v1 = [5, 20, 36, 10, 75, 90] v2 = [10, 25, 8, 60, 20, 80] bar = echarts.Bar("柱状图示例", title_top="52%") bar.add("商家A", attr, v1, is_stack=True)