I created a graph as attached, with additional statistics/info in the graph by manipulating the mlab functionality in Stata. Below is the code I produced to create this graph (graph I have). As you would see, I have two additional statistics (n, and pct) added to the graph on the left, and right end of the spike, respectively. I want these two additional statistics to be added as two columns as shown in the "graph I want". Any advice would be highly appreciated.
Code I used:
Code:
graph twoway (scatter y x, mc(gs0)) (rspike xlow xup y, lc(gs0) hori), sub(, size(small)) by(j, cols(2) legend(off) t1("Graph I have") note (" ")) || /* */ (scatter y xup, m(oh) msize(vtiny) mc(white) mlab(pct) mlabs(small) mlabp(3) mlabc(blue)) || /* */ (scatter y xlow, m(oh) msize(vtiny) mc(white) mlab(n) mlabs(small) mlabp(9) mlabc(red))
y | j | x | xlow | xup | n | pct |
1 | A vs B | 1.96 | 1.62 | 2.3 | 10 | 60.1 |
1 | A vs C | 1.53 | 0.95 | 2.11 | 6 | 11.1 |
2 | A vs B | 1.68 | 1.17 | 2.19 | 9 | 75.5 |
2 | A vs C | 0.21 | -0.33 | 0.75 | 6 | 10.7 |
3 | A vs B | 1.98 | 1.52 | 2.44 | 6 | 61.8 |
3 | A vs C |
Graphs:
Graph I have:
Array
Graph I want:
Array
0 Response to Adding descriptive column in twoway scatter plot
Post a Comment