liveBook · Manning

Seaborn

As explained in The Well-Grounded Data Analyst

Seaborn is a Python visualization library that provides a high-level interface for creating statistical graphics.

Seaborn supports practical exploratory analysis when categorical survey data needs to move from a table of counts to an interpretable visual comparison. section 6.4.2

Use seaborn to:

  • Render pandas crosstabs as heatmaps instead of inspecting tables of numbers. section 6.4.2
  • Show normalized proportions with annotations, fixed minimum and maximum values, square cells, and grayscale or other sequential colormaps. section 6.4.2
  • Compare categorical relationships such as AI use, sentiment, trust, use cases, and job categories. section 6.4.2
  • Wrap recurring heatmap settings in a reusable helper that returns the figure and axes. section 6.4.2

Comparing AI sentiment by tool usage

Create a normalized pandas crosstab of AI-tool usage and sentiment, exclude respondents without a meaningful follow-up answer, and pass the result to sns.heatmap with annotations and a 0-to-1 grayscale scale. Add stakeholder-facing titles and axis labels so darker cells represent larger proportions rather than raw counts. section 6.4.2

fig, axis = plt.subplots()

sns.heatmap(
    data=pd.crosstab(
        index=survey.loc[survey["AISelect"]
 != "No, and I don't plan to", "AISelect"],
        columns=survey.loc[survey["AISelect"]
 != "No, and I don't plan to", "AISent"],
        normalize="index"
    ),
    cmap="Greys",
    vmin=0,
    vmax=1,
    square=True,
    annot=True,
    ax=axis
)

fig.suptitle("How favorably do different people view AI tools?")

axis.set(
    xlabel="How favorable is your stance on using AI tools?",
    ylabel="Do you currently use AI tools?"
)

plt.show()

Browse the complete annotated heatmap example, including filtering, crosstab normalization, colormap selection, scale bounds, and plot labeling. section 6.4.2

How The Well-Grounded Data Analyst covers it

How deep it goes
Demonstrates annotated normalized heatmaps, scale bounds, colormaps, labels, and a reusable helper, but not broader statistical visualization.
Examples
Uses AI sentiment, trust, tool use cases, and job categories as survey dimensions for heatmap comparisons.
What it assumes
Assumes tools can load, combine, manipulate, and visualize datasets; uses pandas for exploration and matplotlib alongside seaborn.
What you can do after
Apply it via Python to create annotated heatmaps that compare categorical survey groups and proportions.
How it connects
Connects pandas crosstab, matplotlib figures and axes, categorical data, normalization, and colormaps.

Also explained in

Compare how 3 books explain seaborn →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Data Analyst. The section links point to the parts of the book it draws on.