How To Separate Thousands With Commas Using Facet Grid In Seaborn
I have the following code: d = sns.FacetGrid(data = df, col = 'Company', sharex = False, sharey = False,
Solution 1:
I was having this problem too and came up with a clean solution here by adding a simple loop to format all of the axes with the comma.
# set up the standard plotting of the df
g = sns.PairGrid(wmix, vars = ['ambulatory', 'wheelchair', 'stretcher'], hue="holiday")
g.map_upper(plt.scatter)
g.map_lower(sns.kdeplot)
g.map_diag(sns.kdeplot, lw=2, legend=False)
g.add_legend()
# now add the comma and remove decimal formats for each y axisfor ax in g.axes[:,0]:
ax.get_yaxis().set_major_formatter(mpl.ticker.StrMethodFormatter('{x:,.0f}'))
# this adds the axis labels to each plot
plt.subplots_adjust(top=0.9)
g.fig.suptitle('Ride Count Relationships');
Post a Comment for "How To Separate Thousands With Commas Using Facet Grid In Seaborn"