Last active
August 29, 2015 14:03
-
-
Save aniversarioperu/888ccc066287c2853dd1 to your computer and use it in GitHub Desktop.
Gráfico para averiguar si Perú tiene el IGV entre los más altos del mundo. Datos tomados de Wikipedia http://en.wikipedia.org/wiki/Value-added_tax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(scales) | |
png(width=750, height=480, units="px", filename="chart4.png") | |
# layout | |
par(bty="n", | |
font.axis=2, cex.axis=1, col.axis="#535353", | |
font.lab=2, cex.lab=1, col.lab="#535353", | |
font.main=2, cex.main=1.8, col.main="#3C3C3C", | |
mgp=c(1.5,1,0), | |
bg="#F0F0F0", | |
mar=c(3, 3, 3, 2) + 0.1 | |
) | |
paises <- | |
c('Hungary', 'Iceland', 'Sweden', 'Norway', 'Faroe Islands', 'Denmark', 'Croatia', 'Brazil', 'Romania', 'Finland', 'Portugal', 'Poland', 'Ireland', 'Greece', 'Uruguay', 'Slovenia', 'Italy', 'Spain', 'Netherlands', 'Lithuania', 'Latvia', 'Czech Republic', 'Belgium', 'Argentina', 'Uzbekistan', 'United Kingdom', 'Ukraine', 'Slovakia', 'Serbia', 'Republic of Moldova', 'Morocco', 'France', 'Estonia', 'Bulgaria', 'Belarus', 'Austria', 'Armenia', 'Albania', 'Monaco', 'Montenegro', 'Germany', 'Cyprus', 'Chile', 'Turkey', 'Tunisia', 'Rwanda', 'Russia', 'Peru', 'Malta', 'Macedonia', 'Israel', 'Georgia', 'Dominican Republic', 'Azerbaijan', 'Barbados', 'Saint Kitts and Nevis', 'Peoples Republic of China', 'Pakistan', 'Bosnia and Herzegovina', 'Mexico', 'Kosovo', 'Jordan', 'Guyana', 'Colombia', 'Trinidad and Tobago', 'New Zealand', 'Namibia', 'Mauritius', 'Luxembourg', 'Ghana', 'Fiji', 'Ethiopia', 'Bangladesh', 'Palestine', 'South Africa', 'India', 'Nepal', 'El Salvador', 'Bolivia', 'Venezuela', 'Sri Lanka', 'Philippines', 'Kazakhstan', 'Guatemala', 'Ecuador', 'Vietnam', 'South Korea', 'Paraguay', 'Lebanon', 'Indonesia', 'Egypt', 'Canada', 'Australia', 'Switzerland', 'Liechtenstein', 'Japan', 'Iran', 'Thailand', 'Singapore', 'Panama', 'Maldives', 'Malaysia', 'Taiwan', 'Jersey', 'Andorra'); | |
x <- c(27, 25.5, 25, 25, 25, 25, 25, 25, 24, 24, 23, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19.6, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17.5, 17, 17, 17, 17, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14.5, 14, 13.5, 13, 13, 13, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 4.5) | |
boxplot(x, | |
xlab="Todos los países", | |
ylab="Porcentaje de impuesto IGV", | |
main="", | |
axes=FALSE, | |
border="black", | |
lwd=2 | |
) | |
stripchart(x, vertical=TRUE, method="jitter", | |
pch=21, bg=alpha("#3498db",0.5), | |
add=TRUE) | |
plotted <- c() | |
for( i in 1:length(paises)) { | |
if( !x[i] %in% plotted && x[i] != 18 ) { | |
text(1.2,x[i], paises[i], pos=4, cex=0.7, col="#3498db") | |
} | |
plotted <- c(plotted, x[i]) | |
} | |
text(1.2, 18, "PERU", pos=4, col="red", cex=0.7, | |
font=2) | |
points(1, 18, pch=21, bg="red", col="red") | |
# layout | |
grid(lty=1, col="#D0D0D0", lwd=0.75) | |
axis(2, las=1, at=seq(10, 25, 5), lwd=0, col.ticks="#D0D0D0", lwd.ticks=0.75, padj=-0.3, hadj=-0.5) | |
axis(2, las=1, at=5, lwd=0, col.ticks="#D0D0D0", lwd.ticks=0.75, padj=-0.3, hadj=-2) | |
title(main="Perú tiene el IGV entre los más altos del mundo?", adj=0) | |
#axis(1, labels=FALSE, col="#D0D0D0", col.ticks="#D0D0D0", lwd.ticks=0.75) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment