[seaborn을 이용한 데이터 시각화] #02. jointplot, pairplot, heatmap

1) jointplot

  • kind = { “scatter” | “kde” | “hist” | “hex” | “reg” | “resid” }
sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", kind="reg")

  • additional keyword arguments
sns.jointplot(
    data=penguins, x="bill_length_mm", y="bill_depth_mm",
    marker="+", s=100, marginal_kws=dict(bins=25, fill=False),
)

  • jointgrid parameters
sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", height=5, ratio=2, marginal_ticks=True)

 

seaborn.jointplot — seaborn 0.11.1 documentation

Method for choosing the colors to use when mapping the hue semantic. String values are passed to color_palette(). List or dict values imply categorical mapping, while a colormap object implies numeric mapping.

seaborn.pydata.org


2) pairplot

  • hue="species" : adds a semantic mapping and chances the default marginal plot to a layered kernel density estimate
sns.pairplot(penguins, hue="species")
  • kind="kde" : determines both the diagonal and off-diagonal plotting style
sns.pairplot(penguins, kind="kde")
  • markers=["o", "s", "D"] : applies a style mapping on the off-diagonal axes
sns.pairplot(penguins, hue="species", markers=["o", "s", "D"])
  • corner=True : Set corner=True to plot only the lower triangle
더보기

corner : bool

If True, don’t add axes to the upper (off-diagonal) triangle of the grid, making this a “corner” plot.

sns.pairplot(penguins, corner=True)

 

seaborn.pairplot — seaborn 0.11.1 documentation

Dictionaries of keyword arguments. plot_kws are passed to the bivariate plotting function, diag_kws are passed to the univariate plotting function, and grid_kws are passed to the PairGrid constructor.

seaborn.pydata.org


3) heatmap

  • vmin, vmax : Change the limits of the colormap
ax = sns.heatmap(uniform_data, vmin=0, vmax=1)
  • center =0 : Plot a heatmap for data centered on 0 with a diverging colormap
normal_data = np.random.randn(10, 12)
ax = sns.heatmap(normal_data, center=0)
  • annot=True : Annotate each cell with the numeric value using integer formatting
ax = sns.heatmap(flights, annot=True, fmt="d")
  • linewidths=.5 : Add lines between each cell
ax = sns.heatmap(flights, linewidths=.5)

  • cmap : matplotlib colormap name or object, or list of colors, optional
ax = sns.heatmap(flights, cmap="YlGnBu")
  • center : Center the colormap at a specific value
ax = sns.heatmap(flights, center=flights.loc["Jan", 1955])
  • cbar=False : Don’t draw a colorbar
ax = sns.heatmap(flights, cbar=False)

 

 

seaborn.heatmap — seaborn 0.11.1 documentation

If True, plot the column names of the dataframe. If False, don’t plot the column names. If list-like, plot these alternate labels as the xticklabels. If an integer, use the column names but plot only every n label. If “auto”, try to densely plot non-

seaborn.pydata.org