Hi all,
I am trying to create a graphic that overlays predicted values as scatter points and a few functions. I would like to edit the legend in the graph to report only two elements and show the image of the line style and marker style in a way similar to how Stata shows connected line graphs. Here is a simplified version of the problem. In this example, I would like the first image in the legend to be a slid black line with a black dot in the middle of it. The second image in the legend would be a dashed green line with a green dot in the middle of it. Is this possible? Thanks.
I am trying to create a graphic that overlays predicted values as scatter points and a few functions. I would like to edit the legend in the graph to report only two elements and show the image of the line style and marker style in a way similar to how Stata shows connected line graphs. Here is a simplified version of the problem. In this example, I would like the first image in the legend to be a slid black line with a black dot in the middle of it. The second image in the legend would be a dashed green line with a green dot in the middle of it. Is this possible? Thanks.
Code:
clear set obs 20 gen x=_n gen e=runiform()/2 gen y1 = 5 + 0.25*x + e gen y2 = 8 - 0.35*x + e twoway function z1=5+0.25*x, range(1 20) lpattern(l) lcolor(black) || function z2=8-0.35*x, range(1 20) lpattern(-) lcolor(emerald) || scatter y1 x, msymbol(x) mcolor(black) || scatter y2 x, msymbol(oh) mcolor(emerald)