Seaborn lmplot:限制yaxis

2024-10-02 06:36:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题:在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)

Tags: sizetitlelinepltseabornaxmarkerlabel

热门问题