python - pyplot - cannot draw dotted line -


i'm trying draw scatter plot fitted dotted line.

plt.scatter(x, y, s=z, alpha=0.5) m, b = np.polyfit(x, y, 1) y = [(m*i) + b in x] plt.plot(x, y,':' ) 

i attach result. problem entire length of line doesn't appear dotted, end of it. tried change dashed line , again had same problem. problem image resolution?

enter image description here

the entire line dotted; issue couple things; have points in x close each other @ lower values, , may not sorted. in former case points cramped dotted line appears solid unless zoom way in, , in latter case line overlay making solid.

you can around plotting endpoints of line, or creating new set of sparser x values on plot line fit.