Create locals from the following commands{break} {space 4}{inp:. local rp : di %12.10f 2+sqrt(3)}{break} {space 4}{inp:. local rm : di %12.10f 2-sqrt(3)}{break} {space 4}{inp:. local functionplot  }{break} {space 4}{inp:> (function y =  sqrt(3-(x+2)^2) - 2, lpat(solid) range(-{c 'g}rp' -{c 'g}rm'))}{break} {space 4}{inp:> (function y = -sqrt(3-(x+2)^2) - 2, lpat(solid) range(-{c 'g}rp' -{c 'g}rm'))}{break} {space 4}{inp:> (function y =  sqrt(3-(x-2)^2) + 2, lpat(solid) range(-{c 'g}rm'  {c 'g}rp'))}{break} {space 4}{inp:> (function y = -sqrt(3-(x-2)^2) + 2, lpat(solid) range(-{c 'g}rm'  {c 'g}rp')) }{break} {space 4}{inp:> (function y =  sqrt(3-(x+2)^2) + 2, lpat(solid) range(-{c 'g}rp' -{c 'g}rm'))}{break} {space 4}{inp:> (function y = -sqrt(3-(x+2)^2) + 2, lpat(solid) range(-{c 'g}rp' -{c 'g}rm'))}{break} {space 4}{inp:> (function y =  sqrt(3-(x-2)^2) - 2, lpat(solid) range( {c 'g}rm'  {c 'g}rp'))}{break} {space 4}{inp:> (function y = -sqrt(3-(x-2)^2) - 2, lpat(solid) range( {c 'g}rm'  {c 'g}rp'))}{break} {space 4}{inp:. local graphopts aspectratio(1)}{break} {space 4}{inp:> legend(order(1 "group 1" 2 "group 2" 3 "group 3") rows(1))}
Create this dataset with the following commands{break} {space 4}{inp:. set obs 441}{break} {space 4}{inp:. gen x = .4*mod(_n,21)-4}{break} {space 4}{inp:. gen y = .4*int((_n-1)/21) -4}{break} {space 4}{inp:. gen group = 1}{break} {space 4}{inp:. replace group = 2 if (y+2)^2 + (x+2)^2 <= 3}{break} {space 4}{inp:. replace group = 2 if (y-2)^2 + (x-2)^2 <= 3}{break} {space 4}{inp:. replace group = 3 if (y+2)^2 + (x-2)^2 <= 3}{break} {space 4}{inp:. replace group = 3 if (y-2)^2 + (x+2)^2 <= 3}