简体   繁体   中英

How to adjust x axis labels in a seaborn plot?

I am trying to plot histogram similar to this: Actual plot

However, I am unable to customize the x axis labels similar to the above figure. My seaborn plot looks something like this, my plot

I want the same x-axis labels ranging from 0 to 25000 with equal interval of 5000. It would be great if anyone can guide me in the right direction?

Code for my figure:

sns.set_style('darkgrid')
kws = dict(linewidth=.3, edgecolor='k')
g = sns.FacetGrid(college, hue='Private',size=6, aspect=2, palette = 'coolwarm')
g = g.map(plt.hist, 'Outstate', bins=24,alpha = 0.7,**kws).add_legend()

您应该只需添加以下内容即可:

plt.xticks(np.linspace(start=0, stop=25000, num=6))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM