2024-09-30 20:34:32 发布
网友
我有一个数据框架,以流派作为索引,列中有%的男性和%的女性
我绘制绘图的代码如下所示:
dfPercentile.plot(figsize = (20,10))
但x轴并没有显示所有类型的价值。它只展示了很少的动作片、犯罪片和惊悚片,如下图所示
在xaxis上显示所有类型的标签,我遗漏了什么
您可以这样打印它们:
import string import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.randint(0,100,(26,2)), index=[*string.ascii_lowercase]) ax=df.plot() ax.set_xticks(list(np.arange(df.shape[0]))) ax.set_xticklabels(df.index)
输出:
您可以这样打印它们:
输出:
相关问题 更多 >
编程相关推荐