Hello,
I'm trying to connect the points between two separate scatterplots to show change between t1 and t2 across countries.
The data example below shows a subset of cases with country, year, favorability score toward one superpower, favorability score toward second superpower:
input int country double year float(favor_c1 favor_c2)
40 2019 36.347603 42.74438
40 2022 36.261555 48.29513
41 2019 22.248415 25.96489
41 2022 19.409565 41.10046
42 2019 47.42112 43.82443
42 2022 39.93524 52.72119
43 2019 21.285133 31.4922
43 2022 24.30714 34.981216
44 2019 26.4181 20.78422
44 2022 18.096584 4.002804
45 2019 12.7282 -4.856491
45 2022 24.727976 31.05799
46 2019 -56.16412 -52.11881
46 2022 -71.222824 -31.25629
47 2019 -36.33735 -44.41511
47 2022 -76.46397 -30.76732
48 2019 -47.29562 26.31731
48 2022 -29.733597 37.913708
49 2019 34.979336 30.27762
49 2022 47.82521 42.22549
I'm partway there, but not sure how to connect each country's 2019 and 2022 dots with a line. Here is what I did so far:
reshape wide favor_c1 favor_c2, i(country) j(year)
scatter favor_PRC2019 favor_US2019, mc(green) m(X) || ///
scatter favor_PRC2022 favor_US2022, mc(red) m(Dh) ///
xtitle("Favorability score country 2") ytitle("Favorability score country 1") ///
legend(label(1 "2019") label(2 "2022"))
Greatly appreciate any tips and apologies in advance if I missed something in the documentation.
I'm trying to connect the points between two separate scatterplots to show change between t1 and t2 across countries.
The data example below shows a subset of cases with country, year, favorability score toward one superpower, favorability score toward second superpower:
input int country double year float(favor_c1 favor_c2)
40 2019 36.347603 42.74438
40 2022 36.261555 48.29513
41 2019 22.248415 25.96489
41 2022 19.409565 41.10046
42 2019 47.42112 43.82443
42 2022 39.93524 52.72119
43 2019 21.285133 31.4922
43 2022 24.30714 34.981216
44 2019 26.4181 20.78422
44 2022 18.096584 4.002804
45 2019 12.7282 -4.856491
45 2022 24.727976 31.05799
46 2019 -56.16412 -52.11881
46 2022 -71.222824 -31.25629
47 2019 -36.33735 -44.41511
47 2022 -76.46397 -30.76732
48 2019 -47.29562 26.31731
48 2022 -29.733597 37.913708
49 2019 34.979336 30.27762
49 2022 47.82521 42.22549
I'm partway there, but not sure how to connect each country's 2019 and 2022 dots with a line. Here is what I did so far:
reshape wide favor_c1 favor_c2, i(country) j(year)
scatter favor_PRC2019 favor_US2019, mc(green) m(X) || ///
scatter favor_PRC2022 favor_US2022, mc(red) m(Dh) ///
xtitle("Favorability score country 2") ytitle("Favorability score country 1") ///
legend(label(1 "2019") label(2 "2022"))
Greatly appreciate any tips and apologies in advance if I missed something in the documentation.
Comment