-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigure12.py
More file actions
47 lines (35 loc) · 1.16 KB
/
figure12.py
File metadata and controls
47 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys
import os
import pandas as pd
from brokenaxes import brokenaxes
sys.path.append(os.path.dirname(__file__))
from utils import *
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams.update({'font.size': 15})
plt.rcParams["figure.figsize"] = (6, 4)
plt.rcParams['axes.xmargin'] = 0
plt.rcParams['axes.ymargin'] = 0
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
df = pd.read_csv(RESULTS_DIR + f"/figure12.csv")
plt.figure(figsize=(4, 5.5))
bax = brokenaxes(xlims=((0, 2250), (33200, 33400)), hspace=.02)
def plot(model, color):
dff = df[df["model"] == model]
dfg = dff.groupby(['Rows', 'Cols']).size().reset_index().rename(columns={0: 'count'})
bax.scatter('Rows', 'Cols',
s='count',
c=color,
alpha=0.4,
data=dfg)
plot("transformer", "navy")
plot("rn50", "maroon")
for ax in bax.axs:
ax.set_ylim(0, 5100)
bax.standardize_ticks(512, 512)
bax.set_xlabel("Rows", labelpad=28)
bax.set_ylabel("Columns", labelpad=40)
legend = bax.legend(labels=["Transformer", "ResNet50"])
for handle in legend.legend_handles:
handle._sizes = [30]
savefig(f"/figure12.pdf")