I have data taken from an experiment which I have plotted using plt.plot
and plt.scatter
. The plot comes out with straight lines from point to point.
How can I plot a smooth curve for my data. I have used curve_fit before for linear and quadratic equations but can't think of a way to fit this data to a polynomial.
The code I have is:
prob = scatter_prob(ip1, ips1, is1, iss1)
plt.plot(voltage1, prob)
plt.xlabel('Voltage (V)')
plt.ylabel('Probability of Electron Scattering')
plt.title('Graph of Voltage vs. Probability')
plt.scatter(voltage1, prob)
plt.annotate('Minimum Probability P = ' + str(probmin), xy = (vmin, probmin), xytext = (vmin +1, probmin),
arrowprops=dict(facecolor='yellow', shrink = 0.05))
plt.grid(True)
plt.tight_layout()
plt.show()
and an image of the graph I receive is here:
prob, voltage1, ip1, is1, ips1, and iss1 are numpy arrays. scatter_prob returns
1 - ((Ip1 * Iss1)/(Ips1 * Is1))