95 lines
2.8 KiB
Python
95 lines
2.8 KiB
Python
import pandas as pd
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
def print_data(df):
|
|
print("=========================================")
|
|
print(df)
|
|
print("-----------------------------------------")
|
|
print(df.dtypes)
|
|
print("-----------------------------------------")
|
|
print(df.shape)
|
|
print("-----------------------------------------")
|
|
print(df.info())
|
|
|
|
def load_data(filename, columns):
|
|
df = pd.read_csv(filename, header = None, sep = "\s+", comment ='#')
|
|
df.columns = columns
|
|
df = df.dropna()
|
|
df[columns[0]] = df.year.astype(float)
|
|
print_data(df)
|
|
return df
|
|
|
|
df_cores = load_data("48yrs/cores.dat", ["year", "cores"])
|
|
df_frequency = load_data("48yrs/frequency.dat", ["year", "frequency"])
|
|
df_specint = load_data("48yrs/specint.dat", ["year", "specint"])
|
|
df_transistors = load_data("48yrs/transistors.dat", ["year", "transistors"])
|
|
df_watts = load_data("48yrs/watts.dat", ["year", "watts"])
|
|
|
|
violet = []
|
|
orange = []
|
|
yellow = []
|
|
green = []
|
|
blue = []
|
|
black = []
|
|
|
|
violet.append((196/255, 0/255, 84/255))
|
|
orange.append((237/255, 109/255, 0/255))
|
|
yellow.append((252/255, 200/255, 0/255))
|
|
green.append((98/255, 178/255, 48/255))
|
|
blue.append((48/255, 181/255, 197/255))
|
|
black.append((25/255, 24/255, 21/255))
|
|
|
|
alpha = 0.7
|
|
|
|
plt.rcParams["axes.axisbelow"] = True
|
|
plt.rcParams["figure.figsize"] = (16,9)
|
|
plt.rcParams["lines.markersize"] = 8
|
|
plt.yscale('log')
|
|
plt.grid(True)
|
|
plt.subplots_adjust(right = 0.8)
|
|
|
|
x = df_transistors.year
|
|
y = df_transistors.transistors
|
|
plt.scatter(x, y, marker = "^", color = yellow, alpha = alpha)
|
|
|
|
x = df_specint.year
|
|
y = df_specint.specint
|
|
plt.scatter(x, y, marker = "s", color = blue, alpha = alpha)
|
|
|
|
x = df_frequency.year
|
|
y = df_frequency.frequency
|
|
plt.scatter(x, y, marker = "s", color = green, alpha = alpha)
|
|
|
|
x = df_watts.year
|
|
y = df_watts.watts
|
|
plt.scatter(x, y, marker = "v", color = violet, alpha = alpha)
|
|
|
|
x = df_cores.year
|
|
y = df_cores.cores
|
|
plt.scatter(x, y, marker = "o", color = black, alpha = alpha)
|
|
|
|
plt.xlabel("Year")
|
|
|
|
plt.legend(["Transistors (thousands)",
|
|
"Single-thread SPECint (thousands)",
|
|
"Frequency (MHz)",
|
|
"Typical power (Watts)",
|
|
"Number of logical cores"],
|
|
loc = "upper left",
|
|
bbox_to_anchor=(1.0, 1.0),
|
|
fontsize = "medium")
|
|
|
|
plt.text(0.805, 0.155,
|
|
"Original data up to the year 2010 collected and plotted by\nM. Horowitz, F. Labonte, O. Shacham, K. Olukotun, \nL. Hammond, and C. Batten.",
|
|
fontsize = "x-small",
|
|
transform=plt.gcf().transFigure)
|
|
|
|
plt.text(0.805, 0.125,
|
|
"New plot and data collected for 2010-2017 by K. Rupp.",
|
|
fontsize = "x-small",
|
|
transform=plt.gcf().transFigure)
|
|
|
|
plt.savefig("data_visualisation.png", dpi = 300, orientation = "landscape", papertype ="a4")
|
|
plt.show()
|