0% found this document useful (0 votes)
69 views15 pages

Bar Chart (Muskan and Palak R

This document discusses bar charts and provides examples of how to create them in R software. It defines a bar chart as a chart that presents categorical data using rectangular bars of varying heights or lengths. There are two main types: vertical bar charts and horizontal bar charts. It also describes several sub-types like stacked, grouped, and segmented bar charts. The document provides code examples to generate vertical and horizontal bar charts from sample data in R using the barplot function.

Uploaded by

vishwastc2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views15 pages

Bar Chart (Muskan and Palak R

This document discusses bar charts and provides examples of how to create them in R software. It defines a bar chart as a chart that presents categorical data using rectangular bars of varying heights or lengths. There are two main types: vertical bar charts and horizontal bar charts. It also describes several sub-types like stacked, grouped, and segmented bar charts. The document provides code examples to generate vertical and horizontal bar charts from sample data in R using the barplot function.

Uploaded by

vishwastc2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

BAR CHARTS

Presented by –
* Muskan Kaur(MAT/19/56)
* Palak Kathuria(MAT/19/10)
INTRODUCTION:

*A bar chart or bar graph is a chart or graph that presents


categorical data with rectangular bars with heights or lengths
proportional to the values that they represent. The bars can
be plotted vertically or horizontally. A vertical bar chart is
sometimes called a column chart.

* Bar Charts are widely used because they convey


information in a readily understood fashion. It shows data
that falls into discrete categories.
TYPES OF BARCHARTS
THERE ARE TWO TYPES OF BARCHARTS :

• VERTICAL BAR CHART

• HORIZONTAL BAR CHART


VERTICAL BAR CHART:
A graph that visually displays data using vertical bars going up from
the bottom, whose lengths are proportional to quantities they
represent. It can be used when one axis cannot have a numerical scale.
THERE ARE FURTHER MORE TYPES OF
VERTICAL BAR CHARTS:

1.VERTICAL STACKED BAR CHART

2. GROUPED VERTICAL BAR CHART

3. SEGMENTED VERTICAL BAR CHART


VERTICAL STACKED BAR CHART:
Use a vertical stacked bar chart when you want to
view information for one dimension within another
dimension.

. GROUPED VERTICAL BAR CHART:


A grouped bar chart is a type of bar graph
that is used to represent and compare
different categories of two or more groups.

SEGMENTED VERTICAL BAR


CHART:
The stacked bar chart has become quite
popular; it is used for grouping or
categorizing the parts of a whole.
HORIZONTAL BAR CHARTS:
Horizontal bar graphs represent the data horizontally. It is
a graph whose bars are drawn horizontally. The data categories are
shown on the vertical axis and the data values are shown on
the horizontal axis.
HERE ARE SOME TYPES OF
HORIZONTAL BAR CHARTS:

1. HORIZONTAL STACKED BAR CHART

2. HORIZONTAL GROUPED BAR CHART

3. SEGMENTED HORIZONTAL BAR CHART


1. HORIZONTAL STACKED BAR CHART:
Horizontal bar graphs represent the
data horizontally. It is a graph whose bars are
drawn horizontally.

2. HORIZONTAL GROUPED BAR


CHART:
It is a graph whose bars are drawn
horizontally. The data categories are shown
on the vertical axis and the data values are
shown on the horizontal axis.

SEGMENTED HORIZONTAL BAR


CHART:
A segmented Bar chart is one kind of
stacked bar chart, but each bar will
show 100% of the discrete value.
How to make a bar chart in “R” SOFTWARE?

• -> R uses the function barplot( ) to create bar charts . R can draw
both vertical and horizontal bars in the bar chart.
EXAMPLE 1:
Consider a matrix as follows:
Garden <-c(47,19,50,46,9,4)
Hedgerow<-c(10,3,0,16,3,0)
Parkland<-c(40,5,10,8,0,6)
Pasture<-c(2,0,7,4,0,0)
Woodland<-c(2,2,0,0,2,0)
m<-cbind(Garden, Hedgerow, Parkland, Pasture, Woodland)

[1, ] 47 10 40 2 2
[2, ] 19 3 5 0 2 [3,
] 50 0 10 7 0
[4, ] 46 16 8 4 0
[5, ] 9 3 0 0 2
[6, ] 4 0 6 0 0
barplot (m,col=‘lightgreen’)
Example 2 :
Data is given in a vector form:

rain<-c(3,5,7,5,3,2,6,8,5,6,9,8)
rain
[1] 3 5 7 5 3 2 6 8 5 6 9 8
barplot(rain)
month<-c(“Jan”, “Feb” , “Mar” , “Apr” , “May”, “June” , “July” , ”Aug”, “Sep” ,
“Oct”, “Nov”, “Dec”)
barplot(rain, names=month, xlab=‘Month’, ylab=‘rain’ , col=‘red’)
* T.H.A.N.K. Y.O.U *

You might also like