How can I keep seaborn.despine
from putting both of my y-scales onto the left side of my plot?
The best I've come up with so far is:
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)
But any other combination will either not despine the y-axes or put the right axis onto the left.
Output of the above: (desired output has no spines, just numbers on left and right)
I guess that's what you want then.
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With