seaborn's
despine
has arguments
以便选择要隐藏的脊椎(默认情况下,除了左边的脊椎外,其他所有脊椎)。
上、右、左、下:布尔型,可选
如果是真的,移除脊椎。
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
%matplotlib inline
values = np.random.randint(1,20,100)
f = plt.figure()
ax = f.add_subplot(111)
sns.despine(offset=10, left=True, right=False) # <-- only show the right spine
ax.yaxis.tick_right()
ax.yaxis.set_ticks_position('right') # <--- I also edited this line to have tick marks only on the right
sns.distplot(values)