Created
January 8, 2020 13:02
-
-
Save cereniyim/df1c8646411cc34eb9720a79400a200f to your computer and use it in GitHub Desktop.
Distribution plot with mean and median
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the plot size | |
figsize(14,10) | |
# set the histogram, mean and median | |
sns.distplot(trees["Cover_Type"], kde=False) | |
plt.axvline(x=trees.Cover_Type.mean(), linewidth=3, color='g', label="mean", alpha=0.5) | |
plt.axvline(x=trees.Cover_Type.median(), linewidth=3, color='y', label="median", alpha=0.5) | |
# set title, legends and labels | |
plt.xlabel("Cover_Type") | |
plt.ylabel("Count") | |
plt.title("Distribution of Trees/Labels/Cover_Types", size=14) | |
plt.legend(["mean", "median"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment