Python 具有两个y形刻度的Seaborn Skeen(双倍)

Python 具有两个y形刻度的Seaborn Skeen(双倍),python,matplotlib,seaborn,Python,Matplotlib,Seaborn,我怎样才能防止seaborn.skidene把我的两个y型刻度都放在绘图的左侧? 到目前为止,我想到的最好的方法是: import matplotlib.pyplot as plt import seaborn as sns import numpy as np sns.set_style("white") fig, ax = plt.subplots() ax.plot(np.random.rand(10)) ax2 =ax.twinx() ax2.plot(100*np.random.r

我怎样才能防止
seaborn.skidene
把我的两个y型刻度都放在绘图的左侧? 到目前为止,我想到的最好的方法是:

import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

sns.set_style("white")

fig, ax = plt.subplots()
ax.plot(np.random.rand(10))
ax2 =ax.twinx()
ax2.plot(100*np.random.rand(10))
sns.despine(ax=ax, right=True, left=True)
sns.despine(ax=ax2, left=True, right=False)
但任何其他组合都不会轻视y轴或将右轴置于左轴

上述输出:(所需输出没有脊椎,只有左右两侧的数字)


我想那正是你想要的

import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

sns.set_style("white")

fig, ax = plt.subplots()
ax.plot(np.random.rand(10))
ax2 =ax.twinx()
ax2.plot(100*np.random.rand(10))
sns.despine(ax=ax, right=True, left=True)
sns.despine(ax=ax2, left=True, right=False)
ax2.spines['right'].set_color('white')

不确定我是否理解正确,因为如果我运行您的代码片段,我会在一边看到一个y刻度,在另一边看到一个y刻度。这不是你想要的吗?也许你可以加上一个数字…公平点-我没有在我的问题中设置seaborn风格,这使得鄙视没有必要!如果您想在两侧显示轴线(这是我想做的),那么您可以这样做:``sns.sdespene(ax=ax,right=True,left=False)sns.sdespene(ax=ax2,left=True,right=False)```