Hello Statalist,
I am working on a twoway connected graph for which I would like to include markers for only a subset of points.
There are about 100 observations in my dataset, so allowing markers at all points is too busy, while plotting only a subset of the points reduces the smoothness of the graph lines. I can combine a connected and a scatter plot, but then the legend does not combine the line with the marker.
Any advice welcome, code and results follow.
Thanks,
Raymond
1. Markers for all points
Result:

2. Plot only every 10th point
Result:

3. Combine twoway with scatter
Result:
I am working on a twoway connected graph for which I would like to include markers for only a subset of points.
There are about 100 observations in my dataset, so allowing markers at all points is too busy, while plotting only a subset of the points reduces the smoothness of the graph lines. I can combine a connected and a scatter plot, but then the legend does not combine the line with the marker.
Any advice welcome, code and results follow.
Thanks,
Raymond
1. Markers for all points
Code:
twoway connected all_d realpce_usd_ppp_grid, /// xscale(log) xlab(1.25 2.5 5 10 20)
2. Plot only every 10th point
Code:
twoway connected all_d realpce_usd_ppp_grid /// if mod(_n-1,10)==0, /// xscale(log) xlab(1.25 2.5 5 10 20)
Result:
3. Combine twoway with scatter
Code:
twoway (connected all_d realpce_usd_ppp_grid, msymbol(i)) /// || (scatter all_d realpce_usd_ppp_grid if mod(_n-1,10)==0, mcolor(stc1)) /// , xscale(log) xlab(1.25 2.5 5 10 20)
Comment