Remote plotting using ssh and visual studio code

I am on a MacBook Pro and I am using visual studio code to ssh into my university cluster. I have XQuartz downloaded onto my MacBook and when I open up a basic terminal and remote into my cluster I can run commands like xclock and display a GUI on my Mac. I cannot get this to work when I remote in using visual studio code and run xclock from the embedded VS terminal. I want my workflow to be done entirely in visual studio but this is not realistic if I cannot plot in VScode. Does anyone know how to fix this issue as I am guessing this is something to do with the settings in visual studio code specifically?

This is the error I get inside VS

[djblack@login-i17:~] $xclock
Error: Can't open display: localhost:10.0
[djblack@login-i17:~] $

I think this is an ssh issue. Try using the -X flag which will “project” windows onto your screen.

I should’ve mentioned that in the original post. I ssh’ed using the -X flag. I am assuming it’s something with the settings in VScode because I can launch GUIs when I ssh inside my regular terminal but I can’t when I ssh directly from VScode. I am just not sure what settings I need to change