I am plotting a two variable function on a 2d scatter plot, but I want to show a legend on what color on the scatter plot corresponds to what Z-value. Current code I have is below.
x = [1, 2, 3, 4, 5]
y = [1, 2, 3, 4, 5]
z = [3, 8.5, 2.1, 1.8, 9]
fig1, ax1 = plt.subplots()
ax1.scatter(x, y, linewidths=1, alpha = .7, edgecolor= 'k', s=200, c=z)
plt.show()