Bar Chart of countries with top 100 cities
tmp$Country<-fct_inorder(tmp$Country)
tauchart(tmp)%>%tau_bar("number_of_cities","Country",horizontal = "TRUE")%>% tau_legend()%>% tau_tooltip()
## Neither color nor size aesthetics have been mapped. Legend plugin will be active but not displayed.
# Geographic Map of 100 cities with highest level of PM2.5
cities100<-cities%>%arrange(-PMLevel)%>%top_n(100)
## Selecting by PMLevel
cities100$CityCountry=paste(cities100$City,cities100$Country,sep= ", ")
locs<-geocode(cities100$CityCountry)
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Ahwaz,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Ulaanbaatar,+Mongolia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Sanandaj,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Ludhiana,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Quetta,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kermanshah,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Peshawar,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Gaborone,+Botswana&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Yasouj,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kanpur,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Lahore,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Delhi,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Karachi,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Islamabad,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Lucknow,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Rawalpindi,+Pakistan&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Uromiyeh,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Qom,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Indore,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=khoramabad,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Agra,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Al+Ain,+United+Arab+Emirates&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Riyadh,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Al-Hafouf,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Lanzhou,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kolkata,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Van,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Dakar,+Senegal&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Makkah,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Xining,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Urumqi,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Faridabad,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Greater+Cairo,+Egypt&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## "Greater Cairo, Egypt" not uniquely geocoded, using "17 mohammed mazhar, zamalek, giza governorate, egypt"
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Mexicali,+Mexico&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Jabalpur,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Dhaka,+Bangladesh&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Mumbai,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Dhanbad,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Ilam,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Jeddah,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Allahabad,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Bushehr,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kerman,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Jinan,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kuwait+City,+Kuwait&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Lagos,+Nigeria&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Beijing,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Dammam,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Patna,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Sarajevo,+Bosnia+and+Herzegovina&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Abu+Dhabi,+United+Arab+Emirates&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Meerut,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Xi'an,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Jaipur,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Qazvin,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Medan,+Indonesia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Chengdu,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Hefei,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Shenyang,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Yanbu,+Saudi+Arabia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kathmandu+Valley,+Nepal&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Taiyuan,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Varanasi,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Chongqing,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Wuhan,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Esfahan,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Shijiazhuang,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Konya,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Kars,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Hamedan,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Arak,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Harbin,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Tianjin,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Nanjing,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Denizli,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Zhengzhou,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Pune,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Hatay,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Nagpur,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Accra,+Ghana&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Hangzhou,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Tehran,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Yangon,+Myanmar&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Erzurum,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Bhopal,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Changsha,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Vijayawada,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Tecate,+Mexico&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Yinchuan,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Bangalore,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Rajkot,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Mandalay,+Myanmar&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Hyderabad,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Visakhapatnam,+India&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Mashhad,+Iran+(Islamic+Republic+of)&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Sfax,+Tunisia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Tunis,+Tunisia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Bizerte,+Tunisia&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Changchun,+China&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=Balikesir,+Turkey&key=xxx-iMAjn1VWGCYdwDmIQ90jh7xgiXGwE
cities100$lat<-locs$lat
cities100$lon<-locs$lon
## Using ggplot 2
worldmap <- borders("world", fill="lightgray",colour="white")
worldmap <- ggplot()+worldmap
worldmap <- worldmap + geom_point(data = cities100,aes(x=lon,y=lat,size=PMLevel),alpha=.4,color="red")
worldmap + theme_void()
