Deactivate plot display to avoid need for X server

question

#1

I use the following type of code to create a gif animation:

using Plots
anim = Animation();
for it = 1:nt
      contourf(...);
      frame(anim);
end
gif(anim, "test.gif", fps = 15);

This works fine on my local notebook or when I connect to a compute node with X server (ssh -X). However, I need to be able to do that without any X server (for distributed jobs). When I run it without an X server available, I get the following error:

gksqt: cannot connect to X server localhost:12.0
connect: Connection refused
GKS: can't connect to GKS socket application
Did you start 'gksqt'?

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

Could you tell me how to avoid the need for an X server, i.e. how I can deactivate any display / how I can deactivate GKS?

Thanks!


#2

You can set the output type before using the gr backend using ENV["GKSwstype"]=100 or ENV[“GKSwstype”]=“nul”`, which activates the NULL device.


#3

Great setting ENV["GKSwstype"]="nul" makes it work! Thank you very much!