Skip to content
Prev 387660 / 398502 Next

Spie charts

Hi Ferri,
Just for fun, I plotted six countries with the current COVID deaths,
per million against both population and median income. Even I was
surprised.

library(plotrix)
country<-c("USA","Brazil","India","UK","Czechia","Mexico")
COVIDdeath<-c(1694,1471,117,1858,2445,1553)
Countrypop<-c(332,214,1390,68,11,130)
poprad<-rescale(cumsum(c(0,Countrypop)),c(0,2*pi))
median_income<-c(65850,9130,2120,42220,21940,9480)
png("COVID_death_by_pop.png")
radial.pie(radial.extents=COVIDdeath,
 sector.edges=poprad,
 sector.colors=color.scale(median_income,extremes=c("red","green")),
 labels=country,radial.lim=c(0,2500))
color.legend(xl=-2600,yb=-2600,xr=500,yt=-2500,
 legend=seq(2000,66000,length.out=5),
 rect.col=color.scale(seq(2000,66000,length.out=5),extremes=c("red","green")))
text(0,2850,"COVID deaths per million population",xpd=TRUE)
text(-1095,-2700,"Median income USD",xpd=TRUE)
text(2000,-2600,"Sector angle = population",xpd=TRUE)
dev.off()


Jim
On Mon, Mar 29, 2021 at 2:59 AM Ferri Leberl <ferri.leberl at gmx.at> wrote:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: COVID_death_by_pop.png
Type: image/png
Size: 40304 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210330/99e3e90a/attachment.png>
Message-ID: <CA+8X3fUZyMDk_xeeOEKAOn2LoRG9nB2Rr5TSx4ODc3-sfrhEVg@mail.gmail.com>
In-Reply-To: <trinity-5049e272-cfad-42a2-acf5-7b69c18c14ca-1616947141164@3c-app-gmx-bs43>