title: "revised hw1" author: "Lanxiang Li" date: "September 24, 2014" output: html_document published:false tags:hw1 ## revised hw1 ### Lanxiang_Li ```{r} setwd("~/Desktop/qmssviz/Lab1") dd <- read.csv("Donation-Disease.csv") ``` ####1 Death of different diseases--scatter diagram ```{r} library(ggplot2) qplot(x = Name, y = Death, data = dd, color = Name) ``` ####2 MoneyRaised of different diseases--scatter diagram ```{r} library(ggplot2) qplot(x = Name, y = MoneyRaised, data = dd, color = Name) ``` ####3 MoneyRaised & Death--scatter diagram ```{r} library(ggplot2) plot(dd$Death,dd$MoneyRaised) ``` ####4 MoneyRaised & Death--line graph ```{r} library(ggplot2) qplot(dd$Death, dd$MoneyRaised, geom="line") ``` ####5 Death of diseases--bar graph ```{r} library(ggplot2) qplot(Name, Death, data=dd, geom="bar", stat="identity",color = Name) ``` ####6 MoneyRaised of diseases--bar graph ```{r} library(ggplot2) qplot(Name, MoneyRaised, data=dd, geom="bar", stat="identity",color = Name) ``` #### my comment: I like the bar graph!Comparing to the scatter one, I think the bar graph is more clear and beautiful. It can show the data in such a beautiful way~ ####7 Death of diseases--Box plot ```{r} library(ggplot2) plot(dd$Name, dd$Death) qplot(dd$Name, dd$Death, geom="boxplot") boxplot(Death ~ Name, data = dd) ``` ####8 Death$MoneyRaised--linear ```{r} library(ggplot2) ggplot(dd, aes(x=Death, y=MoneyRaised)) + geom_point(shape=1) ``` ```{r} library(ggplot2) ggplot(dd, aes(x=Death, y=MoneyRaised)) + geom_point (shape=1) + geom_smooth(method=lm) ``` ####my comment: it seem that the death of a disease does not have much relevance with the MoneyRaised. ####9 MoneyRaised of Diseases--pie chart ```{r} library(ggplot2) par(mar=c(8,8,8,8),font=4) pct <- round (dd$MoneyRaised/sum(dd$MoneyRaised)*100) lbls<- paste(dd$Name, " ",pct, "%", sep="") pie(dd$MoneyRaised, labels=lbls,col=rainbow(length(lbls)), main="pie chart of MoneyRaised") ``` ####10 Death of Diseases--pie chart ```{r} library(ggplot2) par(mar=c(8,8,8,8),font=4) pct <- round (dd$Death/sum(dd$Death)*100) lbls<- paste(dd$Name, " ",pct, "%", sep="") pie(dd$Death, labels=lbls,col=rainbow(length(lbls)), main="pie chart of Death") ```