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


