Created
April 2, 2013 15:42
-
-
Save docsteveharris/5293223 to your computer and use it in GitHub Desktop.
overlapping labels in slope graphs in stata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// try and handle labels over-writing by altering the label position | |
// pos_gap is a variable that controls how close two labels must be before the position is changed | |
// it can only handle a series of 3 overlapping labels | |
// the first is assigned up a clock position | |
// the second is assigned down a clock positon | |
local pos_gap 0.1 | |
bys this_icode (percent): replace pos = pos + 1 /// | |
if abs(percent[_n] - percent[_n+1]) < `pos_gap' /// | |
& pos[_n] == pos[_n+1] | |
bys this_icode (percent): replace pos = pos - 1 /// | |
if abs(percent[_n] - percent[_n-1]) < `pos_gap' /// | |
& pos[_n] == pos[_n-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment