如何增加Python中countplot的字体大小?

如何增加Python中countplot的字体大小?,python,pandas,fonts,seaborn,Python,Pandas,Fonts,Seaborn,我已通过以下代码创建了计数图: plt.figure(figsize = (20,5)) ax=sns.countplot(x = "CompanyName", data = data) ax.set_title("Number of passengers based on gender", fontsize = 20) plt.xlabel("CompanyName",fontsize=17) plt.ylabel("cou

我已通过以下代码创建了计数图:

plt.figure(figsize = (20,5))
ax=sns.countplot(x = "CompanyName", data = data)
ax.set_title("Number of passengers based on gender", fontsize = 20)
plt.xlabel("CompanyName",fontsize=17)
plt.ylabel("count", fontsize=17)
for p in ax.patches:
    ax.annotate(f'\n{p.get_height()}', (p.get_x()+0.2, p.get_height()), color='black', size=15, ha="center")
此图如下所示:


我的问题是:如何增加y轴上的值的描述。我想有例如“阿尔法·罗密欧”、“奥迪”、“宝马”等一款,用大字体书写。您可以更改我上面的代码以实现它吗?

您可以尝试以下方法:

#to increase y ticks size
plt.yticks(size=50)

#to increase x ticks 
plt.xticks(size=50)

您可以尝试以下方法:

#to increase y ticks size
plt.yticks(size=50)

#to increase x ticks 
plt.xticks(size=50)

plt.xticks(已排序(data.CompanyName.unique()),fontsize=22)
。你可以用任何东西换22。您可能需要旋转标签,尽管在添加代码后我出现了类似这样的错误:ConversionError:无法将值转换为axis unitstry,请改为:
plt.rc('xtick',labelsize=22)
这是否回答了您的问题?您可以增加图形大小
plt.xticks(已排序(data.CompanyName.unique()),fontsize=22)
。你可以用任何东西换22。您可能需要旋转标签,尽管在添加代码后我出现了类似这样的错误:ConversionError:无法将值转换为axis unitstry,请改为:
plt.rc('xtick',labelsize=22)
这是否回答了您的问题?您可以增大体形大小