Reputation: 21
I'm plotting a histogram for class and while I have all of the important things figured out, I can't seem to replicate this line style of a solid line with the points showing up on the line. It's almost a combination of dotted and solid.
this is my code for this histogram... n,bins,patches = ax[0,0].hist(Data1,bins=100,density=True)
x = np.arange(bins[0],bins[len(bins)-1],0.25)
y = [normalProbabilityDensity(val,mu=xmu,sigma=xsigma) for val in x]
ax[0,0].axis([600, 1000, 0.000, 0.010])
ax[0,0].yaxis.set_ticks([0.000, 0.002, 0.004, 0.006, 0.008, 0.010])
ax[0,0].set_ylabel('Relative Frequency', fontsize = 10)
ax[0,0].plot(x,y,label="norm prob density", linestyle="dashed")
ax[0,0].legend(loc='upper left', fontsize="8")
ax[0,0].grid(True)
I need the line to look like this image...[
enter image description here](https://i.sstatic.net/Y05hK.png)
Upvotes: 2
Views: 70
Reputation: 3325
You may separately plot the line and the points.
import matplotlib.pyplot as plt
plt.plot([1,2,3], [3,2,4])
plt.scatter([1,2,3], [3,2,4])
plt.show()
Upvotes: 0