<jupyter_start><jupyter_text>Histogram--- Let's import all the dependencies first.<jupyter_code># primary data structure library
import pandas as pd       

# primary plotting library
import matplotlib as mpl       

# importing the pyplot layer of matplotlib for easy usage
import matplotlib.pyplot as plt        

# optional: for ggplot-like style of plots
mpl.style.use(['ggplot'])        

# using the inline backend
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Now we'll create the DataFrame.<jupyter_code># dict for dummy data to be used in dataframe
data = { 'A': [45,67,123,178,154,182,287,243,267,678],
         'B': [23,178,154,182,285,213,267,678,244,365],
         'C': [354,390,489,428,401,502,528,529,561,865]
       }       

# list for indexes to be used in dataframe
index = [1, 2, 3,4,5,6,7,8,9,10]        

# making dataframe
df = pd.DataFrame(data, index=index)   

# showing dataframe
df.T<jupyter_output><empty_output><jupyter_text>Let's create the histogram of the column 'B'.<jupyter_code># ploting the graph
df['B'].plot(kind ='hist',   # type of plot
             alpha=0.6,         # transparency of plot
             figsize=(10, 6)   # size of plot
            )

# giving titles and labels
plt.title('Title of the Plot')
plt.ylabel('Label on Y-axis')
plt.xlabel('Label on X-axis')

# showing the plot
plt.show()<jupyter_output><empty_output><jupyter_text>we can also make the histogram of the whole dataframe as folows.<jupyter_code>df.plot(kind ='hist', 
          figsize=(10, 6),
          alpha=0.6,
          color=['coral', 'darkslateblue', 'mediumseagreen']  # different colours for different columns
         )
plt.title('Title of the Plot')
plt.ylabel('Label on Y-axis')
plt.xlabel('Label on X-axis')
plt.show()<jupyter_output><empty_output><jupyter_text>To change the markings on the x-axis, we need to pass a list as `xticks` parameter. And for changing bin size, pass an integer as `bins` parameter.<jupyter_code>df.plot(kind ='hist', 
          figsize=(10, 6),
          alpha=0.6,
          bins=10,  # passing no of bins
          xticks=[100,200,300,400,500,600,700,800,900,1000],   # passing xticks
          color=['coral', 'darkslateblue', 'mediumseagreen']
         )
plt.title('Title of the Plot')
plt.ylabel('Label on Y-axis')
plt.xlabel('Label on X-axis')
plt.show()<jupyter_output><empty_output><jupyter_text>To make the histogram stacked, we need to pass `stacked=True`.<jupyter_code>df.plot(kind ='hist', 
          figsize=(10, 6),
          alpha=0.6,
          xticks=[100,200,300,400,500,600,700,800,900,1000],
          stacked=True,   # stacking the columns
          color=['coral', 'darkslateblue', 'mediumseagreen']
         )
plt.title('Title of the Plot')
plt.ylabel('Label on Y-axis')
plt.xlabel('Label on X-axis')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1334037310806054, 'fraction_numerical': 0.06406195001759944, 'mean_word_length': 3.5838709677419356, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '220429', 'license': 'MIT', 'n_tokens_mistral': 1123, 'n_tokens_neox': 975, 'n_words': 248, 'path': 'Code/Histogram/Notebook.ipynb', 'repo_name': 'Tarun-Kamboj/Data_Visualization_with_Python', 'size': '2841'}