T = [ 0 -1 0 0; 1 0 0 0; 0 0 1 0; 0 0 0 1]; % pi/2 rot about Z axis

close
fprintf('\nCase 1 - define a line, then set its parent.\n')
newplot 
hgt = hgtransform;
axis([-2 2 -2 2]);
grid on
xlabel('X'); ylabel('Y');
x = line([0;1], [0;0], 'color', 'r');
set(x,'parent',hgt);
set(hgt, 'Matrix', T);  % transforms the given line ([0;1],[0;0])
pause

close
fprintf('\nCase 2 - define a line and its parent.\n')
newplot 
hgt = hgtransform;
axis([-2 2 -2 2]);
grid on
xlabel('X'); ylabel('Y');
x = line([0;1], [0;0], 'color', 'r', 'parent', hgt);  % core funcs presume hgt is an hggroup
set(hgt, 'Matrix', T);  % transforms ([0;0],[1;1]) instead of the given line ([0;1],[0;0])
pause

