首页 > 解决方案 > Seaborn 联合图+散点图未显示完整网格

问题描述

我正在使用 seaborn joinplotscatterplot来生成这种类型的图:

在此处输入图像描述

我的问题是没有显示完整的网格。我已经标记了缺失的部分(应该作为边框)。

编码:

df1 = pd.DataFrame({'col1': X, 'col2':Y})
df2 = pd.DataFrame({'col1': X_main_map, 'col2':Y_main_map})

graph = sns.jointplot(data = df1,x="col1", y="col2",kind="scatter",s=2,color='darkred',marginal_kws={"bins":100,"color":"darkred"},marginal_ticks = True)
graph2 = sns.scatterplot(data = df2, x = "col1",y="col2", s=1,ax=graph.ax_joint)

graph2.set(xticklabels=[])
graph2.set(xlabel=None)
graph2.tick_params(left=False)  # remove the ticks

graph2.set(yticklabels=[])
graph2.set(ylabel=None)
graph2.tick_params(bottom=False)  # remove the ticks

graph2.set(ylim=(-12,20),xlim=(-10,13))

标签: pythonmatplotlibseaborndata-visualization

解决方案


推荐阅读