Files
solveig_master/plot.ipynb
T

149 KiB

Angle

In [56]:
import pandas as pd
import seaborn as sns

df = pd.DataFrame({
    'category': [
        'white-collar',
        'white-collar',
        'white-collar',
        'blue-collar',
        'blue-collar',
        'blue-collar',
        'casual',
        'casual',
        'casual',
    ],
    'angle': [
        'high angle',
        'eye-level',
        'low angle',
        'high angle',
        'eye-level',
        'low angle',
        'high angle',
        'eye-level',
        'low angle',
    ],
    'count': [
        2,
        13,
        7,
        5,
        8,
        5,
        6,
        3,
        1,
    ],
    'pct': [
            2/22*100,
            13/22*100,
            7/22*100,
            5/18*100,
            8/18*100,
            5/18*100,
            6/10*100,
            3/10*100,
            1/10*100,
        ]
})

df
Out [56]:
category angle count pct
0 white-collar high angle 2 9.090909
1 white-collar eye-level 13 59.090909
2 white-collar low angle 7 31.818182
3 blue-collar high angle 5 27.777778
4 blue-collar eye-level 8 44.444444
5 blue-collar low angle 5 27.777778
6 casual high angle 6 60.000000
7 casual eye-level 3 30.000000
8 casual low angle 1 10.000000
In [57]:
import matplotlib.pyplot as plt

g = sns.catplot(
    data=df, kind="bar",
    x="category", y="pct", hue="angle",
    palette="Blues", alpha=.6, height=6
)
g.despine(left=True)
sns.set_style("ticks",{'axes.grid' : True})
g.set_axis_labels("", "percent of total images in category (%)")
g.legend.set_title("")
g.savefig('plots/angle.png')

Contact

In [58]:
import pandas as pd

df = pd.DataFrame({
    'category': [
        'white-collar',
        'white-collar',
        'blue-collar',
        'blue-collar',
        'casual',
        'casual',
    ],
    'contact': [
        'demand structure',
        'offer structure',
        'demand structure',
        'offer structure',
        'demand structure',
        'offer structure',
    ],
    'count': [
        14,
        8,
        0,
        18,
        1,
        9,
    ],
    'pct': [
            14/22*100,
            8/22*100,
            0/18*100,
            18/18*100,
            1/10*100,
            9/10*100,
        ]
})

df
Out [58]:
category contact count pct
0 white-collar demand structure 14 63.636364
1 white-collar offer structure 8 36.363636
2 blue-collar demand structure 0 0.000000
3 blue-collar offer structure 18 100.000000
4 casual demand structure 1 10.000000
5 casual offer structure 9 90.000000
In [59]:
g = sns.catplot(
    data=df, kind="bar",
    x="category", y="pct", hue="contact",
    palette="Blues", alpha=.6, height=6
)
g.despine(left=True)
sns.set_style("ticks",{'axes.grid' : True})
g.set_axis_labels("", "percent of total images in category (%)")
g.legend.set_title("")
g.savefig('plots/contact.png')

Point-of-view

In [60]:
df = pd.DataFrame({
    'category': [
        'white-collar',
        'white-collar',
        'blue-collar',
        'blue-collar',
        'casual',
        'casual',
    ],
    'poit_of_view': [
        'frontal',
        'oblique',
        'frontal',
        'oblique',
        'frontal',
        'oblique',
    ],
    'count': [
        16,
        2,
        4,
        14,
        3,
        7,
    ],
    'pct': [
            16/22*100,
            2/22*100,
            4/18*100,
            14/18*100,
            3/10*100,
            7/10*100,
        ]
})

df
Out [60]:
category poit_of_view count pct
0 white-collar frontal 16 72.727273
1 white-collar oblique 2 9.090909
2 blue-collar frontal 4 22.222222
3 blue-collar oblique 14 77.777778
4 casual frontal 3 30.000000
5 casual oblique 7 70.000000
In [61]:
g = sns.catplot(
    data=df, kind="bar",
    x="category", y="pct", hue="poit_of_view",
    palette="Blues", alpha=.6, height=6
)
g.despine(left=True)
sns.set_style("ticks",{'axes.grid' : True})
g.set_axis_labels("", "percent of total images in category (%)")
g.legend.set_title("")
g.savefig('plots/point-of-view.png')

Distance

In [62]:
import pandas as pd

df = pd.DataFrame({
    'category': [
        'white-collar',
        'white-collar',
        'white-collar',
        'blue-collar',
        'blue-collar',
        'blue-collar',
        'casual',
        'casual',
        'casual',
    ],
    'distance': [
        'long shot',
        'medium shot',
        'close-up',
        'long shot',
        'medium shot',
        'close-up',
        'long shot',
        'medium shot',
        'close-up',
    ],
    'count': [
        6,
        16,
        0,
        15,
        3,
        0,
        3,
        5,
        2,
    ],
    'pct': [
            6/22*100,
            16/22*100,
            0/22*100,
            15/18*100,
            3/18*100,
            0/18*100,
            3/10*100,
            5/10*100,
            2/10*100,
        ]
})

df
Out [62]:
category distance count pct
0 white-collar long shot 6 27.272727
1 white-collar medium shot 16 72.727273
2 white-collar close-up 0 0.000000
3 blue-collar long shot 15 83.333333
4 blue-collar medium shot 3 16.666667
5 blue-collar close-up 0 0.000000
6 casual long shot 3 30.000000
7 casual medium shot 5 50.000000
8 casual close-up 2 20.000000
In [63]:
g = sns.catplot(
    data=df, kind="bar",
    x="category", y="pct", hue="distance",
    palette="Blues", alpha=.6, height=6
)
g.despine(left=True)
sns.set_style("ticks",{'axes.grid' : True})
g.set_axis_labels("", "percent of total images in category (%)")
g.legend.set_title("")
g.savefig('plots/distance.png')
In [ ]: