Вы ищете set_xticklabels
свойство ( doc ).Чтобы применить эту функцию, вам нужно иметь ось.То же самое для ярлыков у с set_yticklabels
.
Здесь код адаптирован из примеров Seaborn :
# Import modules
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
# Create your list of labels
week_list = ["Week_" + str(i) for i in range(1, 10)]
# ['Week_1', 'Week_2', 'Week_3', 'Week_4', 'Week_5', 'Week_6', 'Week_7', 'Week_8', 'Week_9']
fig = plt.figure() # Create a new figure for getting axis
ax = fig.add_subplot(111) # Get the axis
# Create a random dataset across several variables
rs = np.random.RandomState(0)
n, p = 40, 8
d = rs.normal(0, 2, (n, p))
d += np.log(np.arange(1, p + 1)) * -5 + 10
# Use cubehelix to get a custom sequential palette
pal = sns.cubehelix_palette(p, rot=-.5, dark=.3)
# Show each distribution with both violins and points
sns.violinplot(data=d, palette=pal, inner="points")
week_list = ["Week_" + str(i) for i in range(1,10)]
# Set the x labels
ax.set_xticklabels(week_list)
# Show figure
plt.show()