BarPlot Flashcards

1
Q

What is the purpose of the estimator parameter in a Seaborn barplot?

A

The estimator parameter specifies the function used to aggregate data (default: mean). Common options include sum, median, or len.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you disable error bars in a Seaborn barplot?

A

Set ci=None in the sns.barplot() function to disable error bars.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the hue parameter do in a barplot?

A

The hue parameter adds subgroups to the categorical variable, splitting bars by a second categorical column (e.g., hue='sex').

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you create a horizontal barplot?

A

Use orient='h' and swap x and y variables (e.g., x='total_bill', y='day', orient='h').

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you reorder categories in a barplot?

A

Use the order parameter to specify category order (e.g., order=['Sun', 'Sat', 'Fri', 'Thur']).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the default confidence interval (ci) value?

A

The default is ci=95, which calculates a 95% confidence interval for error bars.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you show standard deviation instead of confidence intervals?

A

Set ci='sd' to display standard deviation as error bars.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you customize bar colors in a barplot?

A

Use the palette parameter (e.g., palette='Blues_d') or color for uniform colors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you add annotations to bars?

A

Loop through ax.patches and use ax.annotate() to add text labels.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you visualize total values (sum) instead of averages?

A

Set estimator=sum to aggregate data by summing values per category.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly