From cb22729579b1ad0afb3c8d8f26141ea8702a93f0 Mon Sep 17 00:00:00 2001 From: Heiko J Schick Date: Sun, 21 Nov 2021 14:20:20 +0100 Subject: [PATCH] Added matplot lib function calls --- data_visualisation.py | 66 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/data_visualisation.py b/data_visualisation.py index a64ee87..57e17c2 100644 --- a/data_visualisation.py +++ b/data_visualisation.py @@ -1,15 +1,16 @@ import pandas as pd import numpy as np +import matplotlib.pyplot as plt def print_data(df): - # print("=========================================") + print("=========================================") print(df) - # print("-----------------------------------------") - # print(df.dtypes) - # print("-----------------------------------------") - # print(df.shape) - # print("-----------------------------------------") - # print(df.info()) + 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 ='#') @@ -24,3 +25,54 @@ 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 = [] +violet.append((196/255, 0/255, 84/255)) + +orange = [] +orange.append((237/255, 109/255, 0/255)) + +yellow = [] +yellow.append((252/255, 200/255, 0/255)) + +green = [] +green.append((98/255, 178/255, 48/255)) + +blue = [] +blue.append((48/255, 181/255, 197/255)) + +black = [] +black.append((25/255, 24/255, 21/255)) + + +x = df_transistors.year +y = df_transistors.transistors +plt.scatter(x, y, marker = "^", color = yellow) + +x = df_specint.year +y = df_specint.specint +plt.scatter(x, y, marker = "s", color = blue) + +x = df_frequency.year +y = df_frequency.frequency +plt.scatter(x, y, marker = "s", color = green) + +x = df_watts.year +y = df_watts.watts +plt.scatter(x, y, marker = "v", color = violet) + +x = df_cores.year +y = df_cores.cores +plt.scatter(x, y, marker = "o", color = black) + +plt.yscale('log') + +# plt.legend(loc="upper right", ["Cold", "Medium", "Hot"]) +plt.legend(["Transistors (thousands)", + "Single-thread SPECint (thousands)", + "Frequency (MHz)", + "Typical power (Watts)", + "Number of logical cores"], + loc = "upper left") + +plt.show() \ No newline at end of file