In [ ]:
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
In [ ]:
 
In [ ]:
# a: understood the best
# b: understood the least
# 0: not annotated
raw_data = """a0aba0
ba0000
b00a00
000a0b
0a000b
000a0b
0000ab
0aa00b
b0a000
0000ab"""
In [ ]:
d = [list(x) for x in raw_data.split("\n")]
df = pd.DataFrame(d)
df
In [ ]:
df = df.replace(to_replace=['a', 'b'], value=["+", '-'])
df
In [ ]:
df[1] = pd.Categorical(df[1], categories=['0', '-', '+'])
df[1].value_counts()
In [ ]:
counts = pd.DataFrame([pd.Categorical(df[c], categories=['0', '-', '+']).value_counts() for c in df.columns])
In [ ]:
counts
In [ ]:
counts.index = pd.Index([
    "Maximize data-ink ratio",
    "Minimize lie factor",
    "Minimize chartjunk",
    "Use scales and labeling well",
    "Use Color Well",
    "Use Repetition Well"])
In [ ]:
counts

In the following two sections, I've started with very basic Seaborn barplots. For practice,

  • Identify ways to improve the presentation of these plots, grounded in the visualization principles
  • Make these improvements, either by tweaking the sns call, or adjusting the plot after creation with matplotlib.

Best-Understood Principles¶

In [ ]:
sns.barplot(counts["+"])

Least-Understood Principles¶

In [ ]:
sns.barplot(counts, x="-", y=counts.index)