Thanks to the ever-energetic Kit Baum, a new command multidot is now available on SSC for Stata 10 up.
(It may even be portable to Stata 8 up, but I have not tried.)
If you suddenly think you've read this before, you're remembering the announcement of multiline on Statalist in https://www.statalist.org/forums/for...ailable-on-ssc
multidot is a cousin, or perhaps a sibling, of multiline, with similar aims but different details.
Install with
The main application of multidot is to plot dot charts or similar charts in separate panels, especially but not only for variables measured in different units or on very different scales.
This can be a good alternative to a superimposed plot if the latter appears unclear or absurd. Alternatively, multidot is a direct solution for situations in which you would be tempted to produce separate graphs and follow with graph combine. That method is highly flexible, particularly combined with use of the Graph Editor, but you may still have to deal with challenges such as removing repeated material and keeping panels the same size.
What multidot does is temporarily restructure the data so that different variables are different groups of a single response variable.
Here is a first example:
The default dot chart is pushed at you partly out of a personal prejudice that such dot charts remain undersold, a few decades after they were promoted by William S. Cleveland in his papers and books. (The name Cleveland dot chart is sometimes used in an attempt to distinguish such charts from histogram-like dot plots.) In the case of both price and mpg, we don't need to see zero on the graph. The key comparisons are between cars, not with zero!
Nevertheless, I suspect that users of this program may find themselves reaching for the recast(bar) option. The second multidot command above does that:
I am not especially pleased to reach for ang(v) but sometimes compromises are needed.
Here's another example. I found some interesting data in an article in the Economist. They had a map with numeric data superimposed. Here are two bar charts.
Although these graphs have the look and feel of those created with graph dot and graph hbar, they are created with twoway. As a courtesy to those familiar with graph hbar, multidot translates a call for hbar as a call for a (horizontal) application of twoway bar.
More handles are explained in the help.
(It may even be portable to Stata 8 up, but I have not tried.)
If you suddenly think you've read this before, you're remembering the announcement of multiline on Statalist in https://www.statalist.org/forums/for...ailable-on-ssc
multidot is a cousin, or perhaps a sibling, of multiline, with similar aims but different details.
Install with
Code:
ssc install multidot
This can be a good alternative to a superimposed plot if the latter appears unclear or absurd. Alternatively, multidot is a direct solution for situations in which you would be tempted to produce separate graphs and follow with graph combine. That method is highly flexible, particularly combined with use of the Graph Editor, but you may still have to deal with challenges such as removing repeated material and keeping panels the same size.
What multidot does is temporarily restructure the data so that different variables are different groups of a single response variable.
Here is a first example:
Code:
sysuse auto, clear set scheme s1color multidot price mpg if foreign, over(make) multidot price mpg weight if foreign, over(make) recast(bar) desc by(row(1)) xla(, ang(v)) blcolor(blue)
The default dot chart is pushed at you partly out of a personal prejudice that such dot charts remain undersold, a few decades after they were promoted by William S. Cleveland in his papers and books. (The name Cleveland dot chart is sometimes used in an attempt to distinguish such charts from histogram-like dot plots.) In the case of both price and mpg, we don't need to see zero on the graph. The key comparisons are between cars, not with zero!
Nevertheless, I suspect that users of this program may find themselves reaching for the recast(bar) option. The second multidot command above does that:
I am not especially pleased to reach for ang(v) but sometimes compromises are needed.
Here's another example. I found some interesting data in an article in the Economist. They had a map with numeric data superimposed. Here are two bar charts.
Code:
clear input str13 country budget active reservists "United States" 604.5 1347 865 "India" 51.1 1395 1155 "China" 145.0 2183 510 "Malaysia" 4.2 109 52 "Singapore" 10.2 73 313 "Vietnam" 4.0 482 5000 "Indonesia" 8.2 396 400 "Philippines" 2.5 125 131 "Taiwan" 9.8 215 1657 "S. Korea" 33.8 630 4500 "Japan" 47.3 247 56 "N. Korea" . 1190 600 "Australia" 24.2 58 21 end label var budget "Defence budget ($ billion)" label var active "Active forces ('000)" label var reservists "Reservists ('000)" note : "Source: The Economist, April 22 2017" note : "Their source: IISS, 2016" multidot b a r, over(c) by(row(1) compact) recast(hbar) subtitle(, size(medsmall)) ytitle("") missing bfcolor(eltgreen) multidot a r b, over(c) by(row(1) compact) recast(hbar) subtitle(, size(medsmall)) ytitle("") xla(#5, labsize(small)) missing bfcolor(eltgreen)
Although these graphs have the look and feel of those created with graph dot and graph hbar, they are created with twoway. As a courtesy to those familiar with graph hbar, multidot translates a call for hbar as a call for a (horizontal) application of twoway bar.
More handles are explained in the help.
Comment