Hey Statalisters,
I'm using Stata IC 15.1 on Ubuntu 18.04.
I'm performing a replication of a paper where part of the task is to recreate figures and tables as presented in the paper [specifically Hornbeck (2012) The Enduring Impact of the American Dust Bowl]. By "as presented", they literally want us to get as close to the formatting of the figures and tables as possible, even if we think there would be a better way, so I'm limited in my options there.
When combining four correctly formatted graphs using graph combine, the legend of each graph does not resize, making it problematically large. For an example of a single, correctly formatted panel of the combined graph:

To demonstrate the problem, see the combined graph after running graph combine:

If this were my figure, I'd create a single legend for the combined graph instead of four separate legends presenting the same information, but that is not the task that I am presented with here (so unfortunately that will not be a solution to my problem in this case).
There are five variables in the dataset: high (a dummy variable), year, and panela-d (the values to be graphed in panels a-d of the combined graph). The data are provided below. Alternatively, you may run example-data.do (attached) on your local machine to replicate these data and play around.
The graph code that I'm running is as follows:
Thank you in advance for your help!
I'm using Stata IC 15.1 on Ubuntu 18.04.
I'm performing a replication of a paper where part of the task is to recreate figures and tables as presented in the paper [specifically Hornbeck (2012) The Enduring Impact of the American Dust Bowl]. By "as presented", they literally want us to get as close to the formatting of the figures and tables as possible, even if we think there would be a better way, so I'm limited in my options there.
When combining four correctly formatted graphs using graph combine, the legend of each graph does not resize, making it problematically large. For an example of a single, correctly formatted panel of the combined graph:
To demonstrate the problem, see the combined graph after running graph combine:
If this were my figure, I'd create a single legend for the combined graph instead of four separate legends presenting the same information, but that is not the task that I am presented with here (so unfortunately that will not be a solution to my problem in this case).
There are five variables in the dataset: high (a dummy variable), year, and panela-d (the values to be graphed in panels a-d of the combined graph). The data are provided below. Alternatively, you may run example-data.do (attached) on your local machine to replicate these data and play around.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(high year panela panelb panelc paneld) 0 1910 .3804232 .13938057 .06717125 0 0 1920 .29096857 -.02201598 -.02639568 0 0 1925 .3235959 .02779344 .05500082 0 0 1930 .2967682 .04154181 .05098339 0 0 1940 .14801647 -.11317556 -.12894858 -.165841 0 1945 .20672284 -.01770455 -.03896629 -.079965 0 1950 .12957312 -.04979724 -.05934685 -.11076 0 1954 .04348083 -.13396148 -.11914609 -.176889 0 1959 -.00214938 -.17888173 -.15281087 -.208838 0 1964 .00257537 -.15869603 -.13308775 -.191528 0 1969 .0806128 -.11893102 -.10048294 -.149467 0 1978 .14555934 -.06421624 -.05646808 -.095153 0 1982 .09354593 -.10921485 -.1311332 -.158265 0 1987 .17033225 -.05206997 -.07952096 -.105048 0 1992 .196814 -.03797659 -.06088841 -.082038 1 1910 .3903552 .22166537 .11100717 0 1 1920 .2442058 -.05341856 -.07923576 0 1 1925 .29781938 .02060834 -.00097896 0 1 1930 .2411681 .00258406 -.01729685 0 1 1940 -.05494594 -.27041736 -.3204603 -.299947 1 1945 -.00116285 -.1799311 -.24106923 -.222674 1 1950 -.09990063 -.22454923 -.25788665 -.244448 1 1954 -.16794223 -.3168834 -.334435 -.334045 1 1959 -.22547296 -.37860805 -.3832861 -.38679 1 1964 -.17159484 -.3189961 -.3266224 -.333192 1 1969 -.05912161 -.2919876 -.2924803 -.301392 1 1978 .00157885 -.27352047 -.27965245 -.286343 1 1982 -.07442225 -.3261899 -.3537643 -.347712 1 1987 -.02207191 -.3050352 -.3124284 -.295149 1 1992 .08771025 -.2172664 -.23523164 -.215386 end
Code:
// ----- create graphs ----- // foreach field in panela panelb panelc paneld { // --- field specific graph titles --- // if "`field'" == "panela" local paneltitle "Panel A: State-by-year fixed effects" if "`field'" == "panelb" local paneltitle "Panel B. 1930 county characteristics + (A)" if "`field'" == "panelc" local paneltitle "Panel C. Lagged county characteristics + (B)" if "`field'" == "paneld" local paneltitle "Panel D. Lagged outcome variable + (C)" // --- individual graphs --- // graph twoway /// (connected `field' year if high == 1, msize(tiny)) /// high erosion (connected `field' year if high == 0, msize(tiny) msymbol(square) lpattern(shortdash) mfcolor(white)), /// medium erosion title("`paneltitle'", span pos(11) size(medium)) /// panel title and formatting ylabel(-0.4(0.1)0.4, format(%2.1f) labsize(small) angle(horizontal) nogrid) /// y axis formatting xlabel(1910(10)2000, labsize(small)) xline(1931, lcolor(black)) /// x axis formating (including xline = 1931) xtitle("") ytitle("") /// supress per panel x- and y-axis titles legend(label(1 "High erosion vs. low erosion") label(2 "Medium erosion vs. low erosion")) /// legend labels legend(cols(1) rows(2) pos(1) ring(0)) graph save f3_`field'.gph, replace graph close } // --- combine graphs --- // graph combine f3_panela.gph f3_panelb.gph f3_panelc.gph f3_paneld.gph, /// note("Figure 3. Estimated Differences in Log Value of Farmland per Acre, by Erosion Level", pos(6)) graph export "3_figure.png", replace graph close
Comment