Browse Source

trying to change line colours for dual graphs, add legends

tarfeef101 6 years ago
parent
commit
0027e4ca4e
1 changed files with 3 additions and 2 deletions
  1. 3 2
      a2/tsp_local.py

+ 3 - 2
a2/tsp_local.py

@@ -279,10 +279,11 @@ def main():
     for i in range(0, 3):
         axes[i].plot(range(1, 11), solution_steps[i], label = "Steps to Solution")
         axes[i].set_xlabel("Problem Instance")
-        axes[i].set_ylabel("Steps Taken")
+        axes[i].set_ylabel("Steps Taken", color = 'b')
         axis_twin = axes[i].twinx()
         axis_twin.plot(range(1, 11), solution_scores[i], label = "Solution Cost/Distance")
-        axis_twin.set_ylabel("Distance in units")
+        axis_twin.set_ylabel("Distance in units", color = 'r')
+        axex[i].legend()
 
     #axes.legend()
     plt.savefig("hill_climbing.pdf")