[seaborn을 이용한 데이터 시각화] #03. barplot, boxplot, pointplot

1) barplot

  • dodge=False : When hue nesting is used, whether elements should be shifted along the categorical axis
tips["weekend"] = tips["day"].isin(["Sat", "Sun"])
ax = sns.barplot(x="day", y="total_bill", hue="weekend",
                 data=tips, dodge=False)

  • saturation=.5 : Proportion of the original saturation to draw colors at
ax = sns.barplot(x="size", y="total_bill", data=tips,
                 color="salmon", saturation=.5)

 

seaborn.barplot — seaborn 0.11.1 documentation

Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the x, y, and/or hue parameters.

seaborn.pydata.org


2) boxplot

  • linewidth
ax = sns.boxplot(x="day", y="total_bill", hue="time",
                 data=tips, linewidth=2.5)
  • orient="h" : Orientation of the plot (vertical or horizontal)
iris = sns.load_dataset("iris")
ax = sns.boxplot(data=iris, orient="h", palette="Set2")

 

seaborn.boxplot — seaborn 0.11.1 documentation

Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the x, y, and/or hue parameters.

seaborn.pydata.org


3) pointplot

  • dodge=True : Separate the points for different hue levels along the categorical axis
ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
                   data=tips, dodge=True)

  • linestyles=["-", "--"]
  • markers=["o", "x"]
ax = sns.pointplot(x="time", y="total_bill", hue="smoker",
                   data=tips,
                   markers=["o", "x"],
                   linestyles=["-", "--"])
  • join=False : Don’t draw a line connecting each point
ax = sns.pointplot(x="tip", y="day", data=tips, join=False)

  • estimator=median : Use median as the estimate of central tendency

 →  Statistical function to estimate within each categorical bin

from numpy import median
ax = sns.pointplot(x="day", y="tip", data=tips, estimator=median)
  • ci=68 : Show the standard error of the mean with the error bars

 → Size of confidence intervals to draw around estimated values. If “sd”, skip bootstrapping and draw the standard deviation of the observations. If None, no bootstrapping will be performed, and error bars will not be drawn.

ax = sns.pointplot(x="day", y="tip", data=tips, ci=68)
  • ci="sd" : Show standard deviation of observations instead of a confidence interval
ax = sns.pointplot(x="day", y="tip", data=tips, ci="sd")
  • capsize=.2 : Add “caps” to the error bars

 → Width of the “caps” on error bars

ax = sns.pointplot(x="day", y="tip", data=tips, capsize=.2)

 

 

seaborn.pointplot — seaborn 0.11.1 documentation

Vectors of data represented as lists, numpy arrays, or pandas Series objects passed directly to the x, y, and/or hue parameters.

seaborn.pydata.org