{"id":1203,"date":"2019-12-07T18:20:44","date_gmt":"2019-12-07T16:20:44","guid":{"rendered":"http:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1203"},"modified":"2019-12-07T18:21:07","modified_gmt":"2019-12-07T16:21:07","slug":"renewable-electricity-output-world-map","status":"publish","type":"post","link":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1203","title":{"rendered":"Renewable electricity output \u2013 World Map"},"content":{"rendered":"<ul>\n<li><a href=\"http:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1194\">http:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1194<\/a><\/li>\n<\/ul>\n<pre class=\"lang:r decode:true\"># ----------------\r\n\r\nlibrary(rworldmap)\r\n\r\noptions(\"scipen\"=100, \"digits\"=4)\r\n\r\nyear &lt;- 2015\r\ntarget.year &lt;- which(renewable.electricity.output$year==year)\r\nhead(renewable.electricity.output[target.year,])\r\n\r\nrenewable.electricity.output.year &lt;- na.omit(renewable.electricity.output[target.year,])\r\nrenewable.electricity.output.year &lt;- renewable.electricity.output.year[which(renewable.electricity.output.year$EG.ELC.RNEW.ZS&gt;0),]\r\n\r\nmapped_data &lt;- joinCountryData2Map(renewable.electricity.output.year, joinCode = \"ISO2\", nameJoinColumn = \"iso2c\")\r\npar(mai=c(0,0,0.2,0),xaxs=\"i\",yaxs=\"i\")\r\nmapCountryData(mapped_data, nameColumnToPlot = \"EG.ELC.RNEW.ZS\",mapTitle=paste(titel,subtitel))\r\n\r\nmapCountryData(mapped_data, nameColumnToPlot = \"EG.ELC.RNEW.ZS\",mapRegion=\"world\",mapTitle=paste(titel,subtitel),\r\n               numCats=2,catMethod=c(0:100),addLegend=FALSE,colourPalette=c(\"red\",\"green\"))\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1204\" src=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot05.png\" alt=\"\" width=\"600\" height=\"467\" srcset=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot05.png 600w, https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot05-300x234.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<pre class=\"lang:r decode:true \">mapCountryData(mapped_data, nameColumnToPlot = \"EG.ELC.RNEW.ZS\",mapRegion=\"world\",mapTitle=paste(titel,subtitel),\r\n               numCats=3,catMethod=c(0:100),addLegend=FALSE,colourPalette=c(\"red\",\"yellow\",\"green\"))\r\nlegend(-179, -10, legend=c(\"low\", \"medium\",\"high\"), col=c(\"red\", \"yellow\",\"green\"), lty=1:3, cex=0.6)\r\n<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1208\" src=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot07.png\" alt=\"\" width=\"600\" height=\"467\" srcset=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot07.png 600w, https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/wp-content\/uploads\/2019\/12\/Rplot07-300x234.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1194 # &#8212;&#8212;&#8212;&#8212;&#8212;- library(rworldmap) options(&#8220;scipen&#8221;=100, &#8220;digits&#8221;=4) year &lt;- 2015 target.year &lt;- which(renewable.electricity.output$year==year) head(renewable.electricity.output[target.year,]) renewable.electricity.output.year &lt;- na.omit(renewable.electricity.output[target.year,]) renewable.electricity.output.year &lt;- renewable.electricity.output.year[which(renewable.electricity.output.year$EG.ELC.RNEW.ZS&gt;0),] mapped_data &lt;- joinCountryData2Map(renewable.electricity.output.year, joinCode = &#8220;ISO2&#8221;, nameJoinColumn = &#8220;iso2c&#8221;) par(mai=c(0,0,0.2,0),xaxs=&#8221;i&#8221;,yaxs=&#8221;i&#8221;) mapCountryData(mapped_data, nameColumnToPlot = &#8220;EG.ELC.RNEW.ZS&#8221;,mapTitle=paste(titel,subtitel)) mapCountryData(mapped_data, nameColumnToPlot = &#8220;EG.ELC.RNEW.ZS&#8221;,mapRegion=&#8221;world&#8221;,mapTitle=paste(titel,subtitel), numCats=2,catMethod=c(0:100),addLegend=FALSE,colourPalette=c(&#8220;red&#8221;,&#8221;green&#8221;)) &nbsp; mapCountryData(mapped_data, nameColumnToPlot = &#8220;EG.ELC.RNEW.ZS&#8221;,mapRegion=&#8221;world&#8221;,mapTitle=paste(titel,subtitel), numCats=3,catMethod=c(0:100),addLegend=FALSE,colourPalette=c(&#8220;red&#8221;,&#8221;yellow&#8221;,&#8221;green&#8221;)) legend(-179, -10, legend=c(&#8220;low&#8221;, &#8220;medium&#8221;,&#8221;high&#8221;), col=c(&#8220;red&#8221;, &#8220;yellow&#8221;,&#8221;green&#8221;), lty=1:3, cex=0.6) &nbsp; &nbsp; &nbsp; &hellip; <a href=\"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/?p=1203\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Renewable electricity output \u2013 World Map<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,4,15,26],"tags":[],"_links":{"self":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1203"}],"collection":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1203"}],"version-history":[{"count":3,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1209,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions\/1209"}],"wp:attachment":[{"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/host6.ssl-net.net\/martinstoppacher_com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}