Seaborn lmplot:限制y轴

时间:2018-05-29 18:27:16

标签: python seaborn correlation

我的问题:在seaborn中配置y轴所需的帮助,以便它显示-1.0到-0.8的范围,然后是间隙,然后是0.8到1.0(用于显示lmplot中的相关系数)

ax_neg_1 = sns.lmplot('Aantal Sterkst Negatief', # Horizontal axis
       'Corr Sterkst Negatief', # Vertical axis
       data=df_PAR_metingen_half_1, # Data source
       fit_reg=False, # Don't fix a regression line
       hue="Sterkst Negatief", # Set color
       scatter_kws={"marker": "D", # Set marker style
                    "s": 100, 'alpha':0.3}, size=12) # S marker size, transparency & size

# Plot horizontal line
y=0
plt.axhline(y=y, c='red',linestyle='dashed',zorder=-1)

# Set title
plt.title('Correlations by chemical', fontweight='bold', fontsize=12)

# Set x-axis label
plt.xlabel('Count')

# Set y-axis label
plt.ylabel('Correlation Coefficient')

axes = ax_neg_1.axes
axes[0,0].set_ylim(-1, 1)

1 个答案:

答案 0 :(得分:0)

没有数据很难测试,但这可能会有所帮助

from matplotlib.patches import Rectangle
axes[0,0].add_patch(Rectangle((-0.8, -1), 1.6, 1, color='white'))
相关问题