Presentation On Pie Chart
Presentation On Pie Chart
• SCATTER PLOTS
• PIE CHARTS
By Sweta and Alishah
•
•
INTRODUCTION TO
GRAPHICAL ANALYSIS
• Now we Know to use R – a programming language havinf
mainfocus on delivering better way to perform statistics , data
analysis , graphical modules.
• Graphs are powerful way to present out data and results in a
concise manner .
• R allows us to create different plot types , ranging from basic
graph like box plots , scatter plots , to pie charts and bar graph .
SCATTER PLOTS
• The scatter plot is used especially to show the relationship
between two variables.
• To produce x-y scatter plot we use the following the command
plot ( ) command
• Let’s take an example of Dataframe to understand it .
EXAMPLE
• > fw
● count ● speed
● A ● 9 ● 2
● B ● 25 ● 3
● C ● 2 ● 5
● D ● 14 ● 9
● E ● 25 ● 14
● F ● 24 ● 24
● G ● 47 ● 29
• As this data frame contains two coloumns of numeric value ,
therefore they are forming basis for scatter plot.
• Basic command plot (x ,y , ……..) as here data is contained in
data frame .
• We use $ syntax to get all the variables
> plot ( fw $ speed , fw $ count )
• Setting axis label limits
x lim = c (start ,end )
y lim = c( start ,end )
• Adding axes labels
• x lab = ‘speed m/s’
• y lab = ‘count my fly’
• We can add all those elements together to produce a plot.
• >plot (fw $ speed , fw$ count , xlab = ‘speed m/s’ , ylab = ‘count my fly’ ,
xlim =c(0, 50), ylim = c(0, 50))
•
•
PIE CHARTS
• In simple terms , the pie chart takes a series of data ,
determines the proportion of each item toward the total.
• If you have data that represents how something is divided up
between various categories , the pie chart is a common
graphic choice to illustrate your data.
• For eg : you might have data that shows sales for various items
for whole year, the pie chart enables you to show how each
item contributed to the total sale.
• Each item is represented by a slice of pie –the bigger the slice
the bigger the contribution to the total sales.
•
HOW TO CREATE A PIE CHART ?
• Pie charts can be created by using the pie command , i.e
pie ( ) command
• For eg: let’s take a vector of numeric values
>data11
[1] 3 5 7 5 3 2 6 8 5 6 9 8
• Now by using the pie ( ) command , these values are converted
to the proportion of the total .
IF YOU WANT YOUR SLICES TO BE NAMED
•
vector
JAN FEB MAR APR MAY JUN JUL AUG SEP NOV
DIRECTION OF THE SLICES
• The direction and the starting point of the slices can be alter
using the command
clockwise = and init.angle =
• By default the slices are drawn counterclockwise , so clockwise =
FALSE , you can set this to TRUE to produce clockwise slices.
• By default the starting angle is 0 degree .
• The default colors used are a range of six pastel colors , you can
specify a range of colors to use with the command ,
col = instruction
• One way to do this is to make a list of color names .