Histogram
The histogram represents the frequency of occurrence of specific phenomena which lie within a specific range of values and are arranged in consecutive and fixed intervals. In the below code histogram is plotted for Age, Income, Sales,
So these plots in the output show frequency of each unique value for each attribute.
Python3
# import pandas and matplotlib import pandas as pd import matplotlib.pyplot as plt # create 2D array of table given above data = [[ 'E001' , 'M' , 34 , 123 , 'Normal' , 350 ], [ 'E002' , 'F' , 40 , 114 , 'Overweight' , 450 ], [ 'E003' , 'F' , 37 , 135 , 'Obesity' , 169 ], [ 'E004' , 'M' , 30 , 139 , 'Underweight' , 189 ], [ 'E005' , 'F' , 44 , 117 , 'Underweight' , 183 ], [ 'E006' , 'M' , 36 , 121 , 'Normal' , 80 ], [ 'E007' , 'M' , 32 , 133 , 'Obesity' , 166 ], [ 'E008' , 'F' , 26 , 140 , 'Normal' , 120 ], [ 'E009' , 'M' , 32 , 133 , 'Normal' , 75 ], [ 'E010' , 'M' , 36 , 133 , 'Underweight' , 40 ] ] # dataframe created with # the above data array df = pd.DataFrame(data, columns = [ 'EMPID' , 'Gender' , 'Age' , 'Sales' , 'BMI' , 'Income' ] ) # create histogram for numeric data df.hist() # show plot plt.show() |
Output:
Basic Python Charts
Python Chart is part of data visualization to present data in a graphical format. It helps people understand the significance of data by summarizing and presenting huge amounts of data in a simple and easy-to-understand format and helps communicate information clearly and effectively.
In this article, we will be discussing various Python Charts that help to visualize data in various dimensions such as Histograms, Column charts, Box plot charts, Line charts, and so on.
Table of Content
- Python Charts for Data Visualization
- Histogram
- Column Chart
- Box plot chart
- Pie Chart
- Scatter Chart
- Line Chart
- Area Chart
- Heatmap
- Bubble Chart
- Radar Chart
- Conclusion