我已经编写了下面的代码来可视化一个joyplot。尝试使用 更改 x 轴标签axes.set_xticks
时,出现错误:AttributeError: 'list' object has no attribute 'set_xticks'
import joypy
import pandas as pd
from matplotlib import pyplot as plt
data = pd.DataFrame.from_records([['twitter', 1],
['twitter', 6],
['wikipedia', 1],
['wikipedia', 3],
['indymedia', 1],
['indymedia', 9]], columns=['platform','day'])
# Get number of days in the dataset
numdays = max(set(data['day'].tolist()))
# Generate date strings from a manually set start date
start_date = "2010-01-01"
dates = pd.date_range(start_date, periods=numdays)
dates = [str(date)[:-9] for date in dates]
fig, axes = joypy.joyplot(data,by="platform")
axes.set_xticks(range(numdays)); axes.set_xticklabels(dates)
plt.show()
预期的输出应如下所示,但日期dates
为刻度标签。