I was trying to make a bar chart using the hue option but I find that the bar widths are really thin and the alignment of the bars to the labels also seems off.
Here's the code I used:
with sns.axes_style('whitegrid'):
p = sns.factorplot(data=df_overall, x='item', y='QWK', order=item_order, hue='subject', kind='bar', size=3, aspect=4, legend=False)
p.set_xticklabels(rotation=90, fontsize=8)

However, if I just replace the hue option with the color option, all of the width and alignment problem seem to go away.

Am I doing something wrong?
Yes. hue adds an additional layer of nesting to the bars: http://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.barplot.html
I see. So, there's no way to get around this issue at all then?
You have not explained what you are trying to do.
I would recommend making a reproducible example and posting to stackoverflow.
Will do. Thanks!
@desilinguist Did you ever get this resolved on Stack Overflow?
Not really. I just decided to use subplots instead of faceting since there
didn't seem any way around it.
On Wed, Jul 13, 2016 at 1:12 PM Alex Petralia [email protected]
wrote:
@desilinguist https://github.com/desilinguist Did you ever get this
resolved on Stack Overflow?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mwaskom/seaborn/issues/871#issuecomment-232422667,
or mute the thread
https://github.com/notifications/unsubscribe/AAJ3kOC3He49oEl11Km6ecJn06em4fn3ks5qVRx0gaJpZM4Hj8-O
.
Ah.. I see. Thanks for the info.
sns.barplot(data=popular, x= "Dominant", y="Total", ax=axes[0], order=popular_order, hue="Trend", dodge=False)
I have used dodge=False and solved the problem
skkirtonia's way totally works for me!
sns.barplot(data=popular, x= "Dominant", y="Total", ax=axes[0], order=popular_order, hue="Trend", dodge=False)
I have used dodge=False and solved the problem
Nice and quick solution!
dodge is kind of a weird keyword don't you think? How about width instead to control the widths of the bars?
No, I don’t think it’s a weird keyword.
Most helpful comment
sns.barplot(data=popular, x= "Dominant", y="Total", ax=axes[0], order=popular_order, hue="Trend", dodge=False)
I have used dodge=False and solved the problem