【发布时间】:2018-08-27 17:14:30
【问题描述】:
是否可以在 matplotlib 中的 scatter() 上做多项式回归线?
这是我的图表: https://imgur.com/a/Xh1BO
alg_n = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4...]
orig_hc_runtime = [0.01, 0.02, 0.03, 0.04, 0.04, 0.04, 0.05, 0.09...]
plt.scatter(alg_n, orig_hc_runtime, label="Orig HC", color="b", s=4)
plt.scatter(alg_n, mod_hc_runtime, label="Mod HC", color="c", s=4)
...
x_values = [x for x in range(5, n_init+2, 2)]
y_values = [y for y in range(0, 10, 2)]
plt.xlabel("Number of Queens")
plt.ylabel("Time (sec)")
plt.title("Algorithm Performance: Time")
plt.xticks(x_values)
plt.yticks(y_values)
plt.grid(linewidth="1", color="white")
plt.legend()
plt.show()
eat 数据集是否可以有回归线?如果是这样,请您解释一下我该怎么做。
【问题讨论】:
-
你能告诉我们你用来生成这些图的代码吗?
-
更新示例代码
标签: python matplotlib