Page 282 - Data Science class 11
P. 282
Example:
V<-c(10,14,22,7,35,21,13,42,30,34,20)
png(file= “histogram.png”)
hist(V,xlab=”Weight”,col=”Red”,border= “yellow”)
dev.off()
2. Explain Horizontal bar chart and Stacked bar chart.
Ans. A bar chart is a pictorial representation of data that presents categorical data with rectangular bars whose heights
or lengths are proportional to the rules that they represent. R supports two ways to plot a bar plot. Vertical bars and
Horizontal bars. The bar function attribute ‘horiz’ set to TRUE creates a Horizontal bar chart.
Stacked bar chart extends the standard bar chart extends that standard bar chart from looking at numeric values across
one categorical variable to two. Each bar in a standard bar chart is divided into a number of sub-bars stacked end to
end, each one corresponding to a level of the second categorical variable. Stacked Bar Graphs are used to show how a
larger category is divided into smaller categories and what the relationship of each part has on the total amount.
Unsolved Exercise
Objective Type Questions (Section A)
A. Tick ( ) the correct option.
1. Which plotting package simplifies the creation of complex plots from data in a data frame?
a. ggplot b. plotly
c. ggplot2 d. pygal
2. The meaning of geom is:
a. Geometric b. Geographical
c. Geodesic d. Geotaxis
3. Some of the most commonly used R built-in data sets are:
a. Iris b. USArrests
c. ToothGrowth d. All of these
4. The attribute ‘main’ is used to:
a. Give the x axis title b. Give the y axis title
c. Give the title of the pie chart d. Give the legends title
5. The value “o” in the type parameter of a line chart is used to draw:
a. Only the points b. Only the line
c. Dotted lines d. Both points and lines
6. The data which is grouped into logical ranges in a histogram is known as:
a. Intervals b. Ranges
c. Groups d. Bins
280 Touchpad Data Science-XI

