Browse Source

plots: add labels

Bernadette Elena Hammerle 3 years ago
parent
commit
af16a35172
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/database/dbAnalyser.py

+ 11 - 1
src/database/dbAnalyser.py

@@ -18,6 +18,7 @@ colorLookup = {
     "pigeons": "c"
 }
 
+
 def readFile():
     with open("time.json") as file:
         timeList = json.load(file)
@@ -29,6 +30,7 @@ def readFile():
     print(timeDf.value_counts(subset=["id", "type"]))
     return timeDf
 
+
 def timeMaps(df, plotTitle="plots/maps.png"):
     fig, ax = plt.subplots(figsize=(20,12))
     for mapId, mapDf in df.groupby(["id"]):
@@ -43,10 +45,14 @@ def timeMaps(df, plotTitle="plots/maps.png"):
                 typeMapAvgDf = typeDf.groupby(["markers"]).mean().reset_index()
                 ax.plot(typeMapAvgDf["markers"], typeMapAvgDf["time"], label=mapTypeId, color=colorLookup.get(mapTypeId))
 
-
     ax.legend(title="Maps")
+    ax.legend(title="Marker Type")
+    ax.set_xlabel("Number of Markers", fontsize=15)
+    ax.set_ylabel("Time (ms)", fontsize=15)
+    ax.set_title("Map Libraries", fontsize=20)
     plt.savefig(plotTitle)
 
+
 def mapboxTypes(df, plotTitle="plots/mapbox.png"):
     mapboxDf = df.dropna(subset=["type"])
     fig, ax = plt.subplots(figsize=(20,12))
@@ -58,8 +64,12 @@ def mapboxTypes(df, plotTitle="plots/mapbox.png"):
         ax.plot(typeAvgDf["markers"], typeAvgDf["time"], color=colorLookup.get(mapId))
 
     ax.legend(title="Marker Type")
+    ax.set_xlabel("Number of Markers", fontsize=15)
+    ax.set_ylabel("Time (ms)", fontsize=15)
+    ax.set_title("Mapbox: Markers and Features", fontsize=20)
     plt.savefig(plotTitle)
 
+
 def smallValues(df):
     df = df.loc[df["markers"] < 300]
     timeMaps(df, "plots/mapsSmall.png")