Visualizing with seaborn
Histograms
You can use Seaborn's .histplot()
method to create a histogram,
which provides frequency counts for continuous data. This method uses
the argument bins=
to specify the number of bins in the histogram.
Note: In the plot below, the y-axis represents the count of values falling within each bin.
# view of states with lower population df_small = df.loc[df.loc[:, 'Population_Mil'] < 20] # create histogram sns.histplot(x = 'Population_Mil', data = df_small, bins = 15) plt.show()
Two overlapping distributions to compare frequencies.
# create overlapping histogram with two calls sns.histplot(x = 'Rates.Property.Motor', data = df_small, bins = 15) sns.histplot(x = 'Rates.Property.Burglary', data = df_small, bins = 15, color = 'purple') plt.show()