View Zhirong Zhao's profile on LinkedIn

Blogroll

My pages

Visitors

Powered by

UThinkrunning MT v.4.25

Header image of Hong Kong financial center courtesy of hleung on flickr.

Multiple Lorenz curves in one graph: my notes

LC_weighted-thumb.png

Package ineq in R can plot Lorenz curves. With a little twist, we can even have multiple Lorenz curves in one plot. The left-side plot above shows the Lorenz curves for per capita GDP, per capital local revenue, and per capital local expenditure for China provinces in 2006. The right-side plots show the corresponding Lorenz curves with fiscal measures that are adjusted by spatial price deflators. The first plot was generated by the codes below:

# -------------------------------------------------
library(ineq)
Lc.1 <- Lc(PCGDP);Lc.2 <- Lc(PCRV); Lc.3 <- Lc(PCEP)
# -------------------------------------------------
pdf(file="LC.pdf", width=6,heigh=6)

# Plot ---------------------------------------------
plot(Lc.1,lty="dotted");
lines(Lc.2$p, Lc.2$L,lty="dashed", lwd=1.2, col=4)
lines(Lc.3$p, Lc.3$L,lty="dotdash", lwd=1.5, col=2)

# Legends ---------------------------------------------
lines(c(.05,.15),c(.9,.9),lty="dotted")
lines(c(.05,.15),c(.85,.85),lty="dashed", lwd=1.2, col=4)
lines(c(.05,.15),c(.8,.8),lty="dotdash", lwd=1.5, col=2)

text(.15,.90,"PC Local GDP", pos=4)
text(.15,.85,"PC Local Revenue", pos=4)
text(.15,.8,"PC Local Expenditure", pos=4)
# -------------------------------------------------
dev.off()
# -------------------------------------------------

To have multiple plots in one graph, I used:

# -------------------------------------------------
pdf(file="LC_weighted.pdf", width=12,heigh=6)
par(mfrow=c(1,2))
# -------------------------------------------------
# Codes for plot 1.....
# -------------------------------------------------
# Codes for plot 2.....
# -------------------------------------------------
dev.off()
par(mfrow=c(1,1))
# -------------------------------------------------

Post a comment

Hubert H. Humphrey Institute of Public Affairs