Histogram Chart


Histogram


histogram is a chart that groups numeric data into bins, displaying the bins as segmented columns. They're used to depict the distribution of a dataset: how often values fall into ranges.

A function you can use to plot a histogram


def hist_plot(var, xlabel, ylabel, title):
    df[var].plot(kind = 'hist', figsize = (15, 10))
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.title(title)


Example:

plt.hist(data, edgecolor='black')
plt.title('histogram chart')
plt.xlabel('xlabel')
plt.ylabel('y label')
plt.legend('l')

plt.axvline(6, color='red', label='axvline', linewidth=2)

Comments