tw rspike ymin ymax country, hori lp(dot) || /// pcarrow _2000 country _2022 country, hori || /// sc country yl, m(i) mlab(country) mlabsize(*0.8) /// xsc(noline) xla(1 "$1.0" 2 "$2.0" 3 "$3.0" /// 4 "$4.0" 5 "$5.0" 6 "$6.0" 7 "$7.0", noticks /// glp(solid) glc(gs10) glw(*0.5) labsize(*0.7) //// labcolor(gray)) /// yla(1(1)26, glp(dot) glc(gs10) glw(*0.8) value /// nogrid) /// ysc(off) leg(off) /// note(" Chart: James Wood Source: Kaggle Get the data Download image Created with Datawrapper", size(*0.6)) /// ti(" {bf:BigMac Prices 2000 - 2022}", justification(left) bexpand) /// subti(" Over the last 22 years the price of a BigMac has increase by an average of 100%, but with a few Commonwealth" " outliners seeing their burger prices inflate to between 200% and 300%... Ouch.", justification(left) bexpand size(*0.8))
最后我们在三个国家的线条上面再覆盖一层红色的线条来强调:
tw rspike ymin ymax country, hori lp(dot) || /// pcarrow _2000 country _2022 country, hori || /// sc country yl, m(i) mlab(country) mlabsize(*0.8) /// xsc(noline) xla(1 "$1.0" 2 "$2.0" 3 "$3.0" /// 4 "$4.0" 5 "$5.0" 6 "$6.0" 7 "$7.0", noticks /// glp(solid) glc(gs10) glw(*0.5) labsize(*0.7) //// labcolor(gray)) /// yla(1(1)26, glp(dot) glc(gs10) glw(*0.8) value /// nogrid) /// ysc(off) leg(off) /// note(" Chart: James Wood Source: Kaggle Get the data Download image Created with Datawrapper", size(*0.6)) /// ti(" {bf:BigMac Prices 2000 - 2022}", justification(left) bexpand) /// subti(" Over the last 22 years the price of a BigMac has increase by an average of 100%, but with a few Commonwealth" " outliners seeing their burger prices inflate to between 200% and 300%... Ouch.", justification(left) bexpand size(*0.8)) || /// sc x _2000, m(i) mlab(label1) mlabpos(9) mlabsize(*0.8) mlabc(gray) || /// sc x _2022, m(i) mlab(label2) mlabpos(3) mlabsize(*0.8) mlabc(gray) || /// sc x _2000 if inlist(Country, "Canada", "Australia", "New Zealand"), m(i) /// mlab(label1) mlabpos(9) mlabsize(*0.8) mlabc(red) || /// sc x _2022 if inlist(Country, "Canada", "Australia", "New Zealand"), m(i) /// mlab(label2) mlabpos(3) mlabsize(*0.8) mlabc(red) || /// pcarrow _2000 country _2022 country if inlist(Country, "Canada", "Australia", "New Zealand"), hori color(red)
评论