我在Seaborn做了一个热图,我有一个相应的水平色条。我在colorbar中添加了一个标题,但是,当我真正想要它在colorbar上方时,它会出现在colorbar下面。有什么原因我可以改变吗?是否可以更改标题的字体大小和颜色栏上标签的大小?在fig, ax = plt.subplots(figsize=(30,12))
graph = sns.heatmap(df_pivot, cmap="Blues", linecolor="white", linewidths=0.1,
cbar_kws={"orientation": "horizontal", "shrink":0.40, "aspect":40, "label": "Number of accidents"})
ax.set_title("Number of traffic accidents per day & hour combination",
fontsize=30, fontweight="bold")
from matplotlib import rcParams
rcParams['axes.titlepad'] = 70 # Space between the title and graph
locs, labels = plt.yticks() # Rotating row labels
plt.setp(labels, rotation=0) # Rotating row labels
ax.xaxis.tick_top() # x axis on top
ax.xaxis.set_label_position('top')
graph.tick_params(axis='both',labelsize=15) # Tick label size
graph
这就是目前为止的情况。我希望“事故数量”的标题在颜色条上方,但在热图下方。我希望颜色条和热图一样宽。在