Browse Source

db analyser: changed map names

Bernadette Elena Hammerle 3 years ago
parent
commit
67821f84a0
1 changed files with 13 additions and 4 deletions
  1. 13 4
      src/database/dbAnalyser.py

+ 13 - 4
src/database/dbAnalyser.py

@@ -19,6 +19,15 @@ colorLookup = {
     "pigeons": "c"
 }
 
+nameLookup = {
+    "google": "Google Map React",
+    "leaflet": "React Leaflet",
+    "mapbox_feature": "ReactMapboxGL Feature",
+    "mapbox_marker": "ReactMapboxGL Marker",
+    "mapgl": "react-map-gl",
+    "pigeons": "Pigeon Maps"
+}
+
 
 def readFile():
     filePath = os.path.dirname(os.path.abspath(__file__)) + "/time.json"
@@ -41,14 +50,14 @@ def timeMaps(df, plotTitle="maps.png"):
         if mapId != "mapbox":
             ax.scatter(mapDf["markers"], mapDf["time"], color=colorLookup.get(mapId))
             mapAvgDf = mapDf.groupby(["markers"]).mean().reset_index()
-            ax.plot(mapAvgDf["markers"], mapAvgDf["time"], label=mapId, color=colorLookup.get(mapId))
+            ax.plot(mapAvgDf["markers"], mapAvgDf["time"], label=nameLookup.get(mapId), color=colorLookup.get(mapId))
       
         else:
             for markerType, typeDf in mapDf.groupby(["type"]):
                 mapTypeId = "mapbox_" + markerType
                 ax.scatter(typeDf["markers"], typeDf["time"], color=colorLookup.get(mapTypeId))
                 typeMapAvgDf = typeDf.groupby(["markers"]).mean().reset_index()
-                ax.plot(typeMapAvgDf["markers"], typeMapAvgDf["time"], label=mapTypeId, color=colorLookup.get(mapTypeId))
+                ax.plot(typeMapAvgDf["markers"], typeMapAvgDf["time"], label=nameLookup.get(mapTypeId), color=colorLookup.get(mapTypeId))
 
     ax.legend(title="Marker Type", fontsize=17, title_fontsize=20)
     ax.set_xlabel("Number of Markers", fontsize=20)
@@ -65,7 +74,7 @@ def mapboxTypes(df, plotTitle="mapbox.png"):
     plt.xticks(fontsize=15)
     for markerType, typeDf in mapboxDf.groupby(["type"]):
         mapId = "mapbox_" + markerType
-        ax.scatter(typeDf["markers"], typeDf["time"], label=mapId, color=colorLookup.get(mapId))
+        ax.scatter(typeDf["markers"], typeDf["time"], label=nameLookup.get(mapId), color=colorLookup.get(mapId))
 
         typeAvgDf = typeDf.groupby(["markers"]).mean().reset_index()
         ax.plot(typeAvgDf["markers"], typeAvgDf["time"], color=colorLookup.get(mapId))
@@ -73,7 +82,7 @@ def mapboxTypes(df, plotTitle="mapbox.png"):
     ax.legend(title="Marker Type", fontsize=17, title_fontsize=20)
     ax.set_xlabel("Number of Markers", fontsize=20)
     ax.set_ylabel("Time (ms)", fontsize=20)
-    ax.set_title("Mapbox: Markers and Features", fontsize=25)
+    ax.set_title("ReactMapboxGL: Markers and Features", fontsize=25)
     folder = os.path.dirname(os.path.abspath(__file__)) + "/plots/"
     plt.savefig(folder + plotTitle, bbox_inches="tight")