Pyplot - 反转 Y 标签而不反转条形图 [英] Pyplot - Invert Y labels without inverting bar chart

查看:49
本文介绍了Pyplot - 反转 Y 标签而不反转条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 seaborn 的因子图:

I have a factorplot using seaborn:

import seaborn as sns
sns.set_style('white')
sns.set_context('paper')
g = sns.factorplot(x="Ligand",y="KD",col='Analyte', data=df, kind='bar', col_wrap=5).set(yscale='log')
g.set_titles("{col_name}")
g.set_xticklabels(rotation=90,size=8)
ax = plt.gca()
ax.set_ylim([0.001,0.00000000001])

我想翻转从上到下的y轴,从10 ^ -3到10 ^ -11,但我想保持列下降.这样最大的列将是最低的值.例如10 ^ -11将具有最大的列

I want to flip y-axis that goes from top to bottom, 10^-3 to 10^-11 but I want to keep the columns going down. Such that the biggest column will be the lowest value. For example a 10^-11 will have the biggest column

推荐答案

我发现您可以轻松做到:

I found out that you can simply do:

plt.ylim(reversed(plt.ylim()))

这篇关于Pyplot - 反转 Y 标签而不反转条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆