I'd like to plot a histogram graph in Jupyter notebook for a dataset where its minimum value is ~8e+01, max value 6e+07, mean ~8e+05, median ~1e+05, and mode ~2e+03. I'd also like to show the central tendency lines in the graph. This is my code:
plt.figure(figsize=(7,5))
sns.kdeplot(dataset, shade=True)
plt.vlines(x=np.mean(dataset), ymin=0, ymax=1, color='blue', linestyle='--')
plt.vlines(x=np.median(dataset), ymin=0, ymax=1, color='brown', linestyle='--')
plt.vlines(x=scp.mode(dataset)[0][0], ymin=0, ymax=1, color='red', linestyle='--')
plt.legend(['Dataset', 'Mean', 'Median', 'Mode'], fontsize=12)
plt.show()
However the resulting graph is:
I've searched online, but all the answers I found was either to add plt.show()
, which I have done, and %matplotlib inline
, which only applies to IPython notebook. I can't think of another reason why the graph isn't showing the data properly.
test dataset:
596819.4
642682.4
619509.33
649141.25
545800.05
572019.8
718330.48
830967.23
742220.67
656892.03
1005603.78
653560.14
657444.04
696281.81
709268.62
924993.61
823623.36
734721.29
783935.36
882754.72
821523.45
800603.23
772926.12
800194.34
850931.58