📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 313definition

LINE CHART, PIE CHART AND BAR CHART · Part 4

Chapter 4: 6 · COMPUTER SCIENCE

Year 8955000 Figure . Bar Chart A BarPlot (or BarChart) is one of the most common type of plot. It shows the relationship between a numerical data and a categorical values. Bar chart represents categorical data with rectangular bars.

Each bar has a height corresponds to the value it represents. The bars can be plotted vertically or horizontally. It’s useful when we want to compare a given numeric value on different categories. To make a bar chart with Matplotlib, we can use the plt.bar() function.

Total Population 12th Computer Chapter - - Example import matplotlib.pyplot as plt # Our data labels = ["TAMIL", "ENGLISH", "MATHS", "PHYSICS", "CHEMISTRY", "CS"] usage = [ . , . , . , .

, . , . ] # Generating the y positions. Later, we'll use them to replace them with labels.

= range (len(labels)) # Creating our bar plot plt.bar ( , usage) plt.xticks ( , labels) plt.ylabel ("RANGE") plt.title ("MARKS") plt.show() Output MARKS RANGE ENGLISH MATHS PHYSICS CHEMISTRY CS TAMIL Figure . The above code represents the following: Labels → Specifies labels for the bars. Usgae → Assign values to the labels specified. Xticks → Display the tick marks along the x-axis at the values represented.

Then specify the label for each tick mark. Range → Create sequence of numbers. 12th Computer Chapter - - Data Visualization using Pyplot Bar Graph and Histogram are the two ways to display data in the form of a diagram. Key Differences Between Histogram and Bar Graph The differences between Histogram and bar graph are as follows .

Histogram refers to a graphical representation; that displays data by way of bars to show the frequency of numerical data. A bar graph is a pictorial representation of data that uses bars to compare different categories of data. . A histogram represents the frequency distribution of continuous variables.

Conversely, a bar graph is a diagrammatic comparison of discrete variables. . Histogram presents numerical data whereas bar graph shows categorical data. .

The histogram is drawn in such a way that there is no gap

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →