Skip to content

Instantly share code, notes, and snippets.

@Protonk
Created December 2, 2010 06:04
Show Gist options
  • Save Protonk/724853 to your computer and use it in GitHub Desktop.
Save Protonk/724853 to your computer and use it in GitHub Desktop.
A largely fruitless attempt at circle plotting
library(WDI)
library(ggplot2);
taxes.df<-WDI(country="all",indicator=c("GC.TAX.TOTL.GD.ZS","NY.GDP.MKTP.KD.ZG","NY.GDP.PCAP.KD"),start=2001,end=2009,extra=TRUE);
names(taxes.df)[4:6]<-c("Tax.Revenue","GDP.Growth","GDP")
taxes.df<-subset(taxes.df,taxes.df$region != "Aggregates")
mean.taxes.df<-ddply(taxes.df, .(country),summarise,growth=mean(GDP.Growth,na.rm=TRUE),tax=mean(Tax.Revenue,na.rm=TRUE),GDP=mean(GDP,na.rm=TRUE));
taxes.plot<-ggplot(mean.taxes.df,aes(tax,growth,size=GDP))+geom_point(colour="light green")+geom_point(alpha=0.4)+scale_x_continuous("Taxes as a Percentage of GDP",limits=c(0,40))+scale_y_continuous("GDP Growth Rate")+scale_area("GDP per Capita",to=c(1,15));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment