This is a shameless ripoff of Howto use su with ssh x-forwarding [coderwall.com]
If you ssh to a server and want to do X forwarding, make sure the server allows it in /etc/ssh/sshd_config:
And then your ssh command should include -X, or make sure your ~/.ssh/config includes:
ssh -X servername
And once on the server, prepare your xauth file to be shared the other user before switching and merging it.
xauth extract /tmp/x $DISPLAY chmod 0644 /tmp/x su otherusername xauth merge /tmp/x