scatter-plot

Matplotlib scatter plot with different text at each data point

你说的曾经没有我的故事 提交于 2019-11-26 00:46:22
问题 I am trying to make a scatter plot and annotate data points with different numbers from a list. So, for example, I want to plot y vs x and annotate with corresponding numbers from n . y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199] z = [0.15, 0.3, 0.45, 0.6, 0.75] n = [58, 651, 393, 203, 123] ax = fig.add_subplot(111) ax1.scatter(z, y, fmt=\'o\') Any ideas? 回答1: I'm not aware of any plotting method which takes arrays or lists but you could use annotate() while iterating over the values in n

Make contour of scatter

痞子三分冷 提交于 2019-11-25 23:47:33
问题 In python, If I have a set of data x, y, z I can make a scatter with import matplotlib.pyplot as plt plt.scatter(x,y,c=z) How I can get a plt.contourf(x,y,z) of the scatter ? 回答1: You can use tricontourf as suggested in case b. of this other answer: import matplotlib.tri as tri import matplotlib.pyplot as plt plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') plt.tricontourf(x, y, z, 15) Old reply: Use the following function to convert to the format required by contourf: from numpy

matplotlib scatter plot with different text at each data point

99封情书 提交于 2019-11-25 18:47:03
I am trying to make a scatter plot and annotate data points with different numbers from a list. so for example I want to plot y vs x and annotate with corresponding numbers from n. y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199] z = [0.15, 0.3, 0.45, 0.6, 0.75] n = [58, 651, 393, 203, 123] ax = fig.add_subplot(111) ax1.scatter(z, y, fmt='o') Any ideas? Rutger Kassies I'm not aware of any plotting method which takes arrays or lists but you could use annotate() while iterating over the values in n . y = [2.56422, 3.77284, 3.52623, 3.51468, 3.02199] z = [0.15, 0.3, 0.45, 0.6, 0.75] n = [58, 651