[英]How to increase size of heat map built using seaborn?
下面是在热 map 中显示句子相似度的代码。 最终图是一个 nxn 矩阵,其中每个条目 [i, j] 根据句子 i 和 j 的编码的内积进行着色。
def plot_similarity(labels, features, rotation):
corr = np.inner(features, features)
sns.set(font_scale=1.2)
g = sns.heatmap(
corr,
xticklabels=labels,
yticklabels=labels,
vmin=0,
vmax=1,
cmap="YlOrRd")
g.set_xticklabels(labels, rotation=rotation)
g.set_title("Semantic Textual Similarity")
def run_and_plot(messages_):
message_embeddings_ = embed(messages_)
plot_similarity(messages_, message_embeddings_, 90)
热图工作正常,但是随着消息数量的增加,结果不再可见。 有没有办法缩放热图? 还是根据条目数量增加大小?
谢谢!
我刚刚找到了一种使用以下单个代码增加 plot 大小的方法
import matplotlib.pyplot as plt
plt.subplots(figsize=(20,15))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.