Presentation is loading. Please wait.

Presentation is loading. Please wait.

02 SAJIAN SEBUAH PEUBAH DISKRET Metode Grafik untuk Analisis dan Penyajian Data.

Similar presentations


Presentation on theme: "02 SAJIAN SEBUAH PEUBAH DISKRET Metode Grafik untuk Analisis dan Penyajian Data."— Presentation transcript:

1 02 SAJIAN SEBUAH PEUBAH DISKRET Metode Grafik untuk Analisis dan Penyajian Data

2 1) DOT PLOT

3  Definition of Dot Plot A dot plot is a two-dimensional graphical display of objects, showing some quantitative characteristic of those objects. One axis of the dot plot (usually the horizontal) is a scale covering the range of quantitative values to be plotted. The other axis (usually the vertical) shows descriptive labels that are associated with each of the numeric values.

4 Definition (Con’t) The data objects usually are sorted according to the quantitative values Plotting symbols are placed within the display area of the dot plot, locating each data object at the intersection position for its label on the vertical axis and associated numeric value on the horizontal axis

5 Dot plots can be used to depict raw data, frequency counts, descriptive statistics, and parameter estimates from statistical models Dot plot can convey that information in a way that overcomes some of the problems frequently encountered with other graphical displays The simplest application of the dot plot is to display the empirical distribution of values on a single variable Definition (Con’t)

6  Advantages of Dot Plots 1) Dot plots can show a larger number of data points than either pie charts or bar charts. It can include a surprisingly large number of points– it is really only limited by the space available in the display medium. 2) Dot plots facilitate relatively accurate graphical perception. It only involves comparisons of point locations along a common scale. 3) When a dot plot is used to display the distribution of values on a single variable, it can be viewed as a transposed quantile plot. It shows all of the data and, therefore, provides a particularly accurate depiction of distributional shape.

7 Contoh Data diambil dari database R software. Nama data : mtcars Peubah ada 11 Mpg Cyl Disp Hp Drat Wt Qsec Vs Am Gear Carb Observasi : 32 merk mobil

8 R Syntax dotchart(mtcars$mpg, labels=row.names(mtcars), cex=0.7, main="Gas Milage for Car Models", xlab="Miles Per Gallon") 1)Simple Dot Plot

9 2) Grouped Dot Plot x <- mtcars[order(mtcars$mpg),] # sort by mpg x$cyl <- factor(x$cyl) # it must be a factor x$color[x$cyl==4] <- "red" x$color[x$cyl==6] <- "blue" x$color[x$cyl==8] <- "darkgreen" dotchart(x$mpg,labels=row.names(x), cex=.7,groups= x$cyl, main="Gas Milage for Car Models\ngrouped by cylinder", xlab="Miles Per Gallon", gcolor="black", color=x$color)

10 2) BAR CHART

11 # Simple Bar Plot counts <- table(mtcars$gear) barplot(counts, main="Car Distribution", xlab="Number of Gears") # Simple Horizontal Bar Plot with Added Labels counts <- table(mtcars$gear) barplot(counts, main="Car Distribution", horiz=TRUE, names.arg=c("3 Gears", "4 Gears", "5 Gears")) R Syntax

12 # Stacked Bar Plot with Colors and Legend counts <- table(mtcars$vs, mtcars$gear) barplot(counts, main="Car Distribution by Gears and VS", xlab="Number of Gears", col=c("darkblue","red"), legend = rownames(counts))

13 # Grouped Bar Plot counts <- table(mtcars$vs, mtcars$gear) barplot(counts, main="Car Distribution by Gears and VS", xlab="Number of Gears", col=c("darkblue","red"), legend = rownames(counts), beside=TRUE)

14 # Fitting Labels par(las=2) # make label text perpendicular to axis par(mar=c(5,8,4,2)) # increase y-axis margin. counts <- table(mtcars$gear) barplot(counts, main="Car Distribution", horiz=TRUE, names.arg=c("3 Gears", "4 Gears", "5 Gears"), cex.names=0.8)

15 3) PIE CHART

16 # Simple Pie Chart slices <- c(10, 12,4, 16, 8) lbls <- c("US", "UK", "Australia", "Germany", "France") pie(slices, labels = lbls, main="Pie Chart of Countries") http://www.statmethods.net/graphs/pie.html

17 # Pie Chart with Percentages slices <- c(10, 12, 4, 16, 8) lbls <- c("US", "UK", "Australia", "Germany", "France") pct <- round(slices/sum(slices)*100) lbls <- paste(lbls, pct) # add percents to labels lbls <- paste(lbls,"%",sep="") # ad % to labels pie(slices,labels = lbls, col=rainbow(length(lbls)), main="Pie Chart of Countries")

18 # 3D Exploded Pie Chart library(plotrix) slices <- c(10, 12, 4, 16, 8) lbls <- c("US", "UK", "Australia", "Germany", "France") pie3D(slices,labels=lbls,explode =0.1, main="Pie Chart of Countries ")

19 # Pie Chart from data frame with Appended Sample Sizes mytable <- table(iris$Species) lbls <- paste(names(mytable), "\n", mytable, sep="") pie(mytable, labels = lbls, main="Pie Chart of Species\n (with sample sizes)")

20 Sekian Terimakasih


Download ppt "02 SAJIAN SEBUAH PEUBAH DISKRET Metode Grafik untuk Analisis dan Penyajian Data."

Similar presentations


Ads by Google