// Prepare data
// Formal care use by income quintiles, households with a child
input str5 geo inc1 inc3 inc5
AT 10 7 9
BE 17 38 57
BG 0 10 15
CH 9 27 53
CY 16 19 30
CZ 3 3 4
DE 21 22 23
DK 87 72 83
EE 16 22 14
EL 6 11 12
ES 29 30 45
FI 18 27 41
FR 15 60 64
HR 6 8 13
HU 7 14 15
IE 8 12 34
IS 37 44 34
IT 17 26 28
LT 2 16 10
LU 23 34 56
LV 7 24 11
MT 0 16 15
NL 27 55 70
NO 34 57 53
PL 0 2 4
PT 14 44 36
RO 5 5 13
SE 44 56 32
SI 41 39 38
SK 2 5 0
UK 20 50 53
EU-27 17 34 36
end
// Encode country variable
encode geo, gen(country)
// Create country variable sortet by the size of the income gap
gen diff = inc5 - inc1 // Income gap
egen order = rank(-diff), unique // Create rank variable
labmask order, value(country) decode // Assign value
// labels of country to variable order based on its values

// Run-of-the-mill dot plot
twoway dot inc1 inc3 inc5 order, vertical ///
legend(label(1 "1{sup:st} income quintile (poorest)") ///
label(2 "3{sup:rd} income quintile") ///
label(3 "5{sup:th} income quintile (richest)") ///
order(3 2 1) ring(0) pos(12)) ///
msymbol(th oh t) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the difference */
/* between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap1, replace)

// Without dots
scatter inc1 inc3 inc5 order, ///
legend(label(1 "1{sup:st} income quintile (poorest)") ///
label(2 "3{sup:rd} income quintile") ///
label(3 "5{sup:th} income quintile (richest)") ///
order(3 2 1) ring(0) pos(12)) ///
msymbol(th oh t) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the difference /*
*/between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap2, replace)

// With numbers instead of symbols
// Not sure whether this is the most elegant move
reshape long inc, i(geo) j(j)
twoway (dot inc order if j == 1, mlabel(j) mlabpos(0) msymbol(i)) ///
(dot inc order if j == 3, mlabel(j) mlabpos(0) msymbol(i)) ///
(dot inc order if j == 5, mlabel(j) mlabpos(0) msymbol(i)), ///
legend(label(1 "1 1{sup:st} income quintile (poorest)") ///
label(2 "3 3{sup:rd} income quintile") ///
label(3 "5 5{sup:th} income quintile (richest)") ///
order(3 2 1) ring(0) pos(12)) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the difference /*
*/ between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap3, replace)

// With ordinal numbers and without dots
label define j 1 "1{sup:st}" 3 "3{sup:rd}" 5 "5{sup:th}"
label value j j
twoway (dot inc order if j == 1, mlabel(j) mlabpos(0) msymbol(i) ndots(0)) ///
(dot inc order if j == 3, mlabel(j) mlabpos(0) msymbol(i) ndots(0)) ///
(dot inc order if j == 5, mlabel(j) mlabpos(0) msymbol(i) ndots(0)), ///
legend(label(1 "1{sup:st} income quintile (poorest)") ///
label(2 "3{sup:rd} income quintile") ///
label(3 "5{sup:th} income quintile (richest)") ///
order(3 2 1) ring(0) pos(12)) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the difference /*
*/ between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap4, replace)

// With arrows
reshape wide // Get data back into old format
twoway (pcarrow inc5 order inc1 order) ///
(scatter inc5 order) ///
, legend(label(2 "5{sup:th} income quintile (richest)") ///
label(1 "Difference between the 5{sup:th} /*
*/ and 1{sup:st} income quintile") ///
order(1 2) ring(0) pos(12)) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the /*
*/ difference between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap5, replace)

// With a line
twoway (rspike inc5 inc1 order) ///
(scatter inc5 order) ///
(scatter inc1 order, msymbol(oh)) ///
(scatter inc3 order, msymbol(th)) ///
, legend(label(3 "1{sup:st} income quintile (poorest)") ///
label(2 "5{sup:th} income quintile (richest)") ///
label(1 "Difference between the 5{sup:th} /*
*/ and 1{sup:st} income quintile") ///
label(4 "3{sup:rd} income quintile") ///
order(2 4 3) ring(0) pos(12)) ///
xlabel(1/32, valuelabels ang(v)) /// // turn on labels
xtitle("") ///
ytitle("% formal care use of households with" ///
"a child younger than 3 years of age") ///
caption("Note: Countries sorted by the size of the difference /*
*/ between the 5{sup:th} and 1{sup:st} quintile" ///
"Source: EU-SILC 2010", span) ///
name(incomegap6, replace)