浏览代码

adding both lines to axis (hopefully), and changing colours of actual lines

tarfeef101 6 年之前
父节点
当前提交
1bb4357b0b
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      a2/tsp_local.py

+ 4 - 4
a2/tsp_local.py

@@ -277,15 +277,15 @@ def main():
     figure, axes = plt.subplots(3, 1, True)
             
     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].plot(range(1, 11), solution_steps[i], label = "Steps to Solution", color = 'b')
+        axes[i].set_xlabel("Problem Instance w/ " + i + " cities")
         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.plot(range(1, 11), solution_scores[i], label = "Solution Cost/Distance", color = 'r')
         axis_twin.set_ylabel("Distance in units", color = 'r')
         axes[i].legend()
+        axis_twin.legend()
 
-    #axes.legend()
     plt.savefig("hill_climbing.pdf")
 
 main()