I need to create a graph with two panels and a common y axis. I'm using Stata version 16.1. The user-contributed command -tabplot- (ssc, by Nick Cox) gets me very close to what I want:

From here I would like to:
a) give each panel a different x-axis, rather than showing blank spaces where there are no values;
b) remove the note "Graphs by period" at the bottom (I can do it through the Graph Editor, but can it be done directly when creating the graph?)
Here are the data and code for the image above:
For a) I tried creating two separate tabplot graphs, omitting the y-axis from the second one, and joining them with -graph combine-, then played with fxsize() to equalize the individual panel widths. The problem there was that the ticks on the y-axis of the two panels were no longer aligned.
From here I would like to:
a) give each panel a different x-axis, rather than showing blank spaces where there are no values;
b) remove the note "Graphs by period" at the bottom (I can do it through the Graph Editor, but can it be done directly when creating the graph?)
Here are the data and code for the image above:
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(country freq) str9 years float period
1 400 "1990-1995" 1
1 308 "1995-2000" 1
1 418 "2005-2010" 2
1 679 "2010-2015" 2
2 490 "1990-1995" 1
2 54 "1995-2000" 1
2 -174 "2005-2010" 2
2 -530 "2010-2015" 2
3 -491 "1990-1995" 1
3 50 "1995-2000" 1
3 107 "2005-2010" 2
3 858 "2010-2015" 2
4 -221 "1990-1995" 1
4 -141 "1995-2000" 1
4 -359 "2005-2010" 2
4 498 "2010-2015" 2
5 -220 "1990-1995" 1
5 925 "1995-2000" 1
5 648 "2005-2010" 2
5 514 "2010-2015" 2
6 28 "1990-1995" 1
6 229 "1995-2000" 1
6 -184 "2005-2010" 2
6 320 "2010-2015" 2
7 44 "1990-1995" 1
7 907 "1995-2000" 1
7 -316 "2005-2010" 2
7 -234 "2010-2015" 2
end
label values country co
label def co 1 "Mexico", modify
label def co 2 "Guatemala", modify
label def co 3 "El Salvador", modify
label def co 4 "Honduras", modify
label def co 5 "Nicaragua", modify
label def co 6 "Costa Rica", modify
label def co 7 "Panama", modify
* Create the graph
tabplot country years [iw=freq], bfcolor(%30) barwidth(1) subtitle("") ///
showval(format(%9.0fc) mlabsize(vsmall)) xtitle("") xlabel(,labsize(small)) ///
yasis ytitle("") ylabel(,labsize(small)) by(period)
For a) I tried creating two separate tabplot graphs, omitting the y-axis from the second one, and joining them with -graph combine-, then played with fxsize() to equalize the individual panel widths. The problem there was that the ticks on the y-axis of the two panels were no longer aligned.

Comment