Search code examples
macosgnuplot

Gnuplot set term display window bug with qt on MacOS


Problem statement: I am using qt term in gunplot to do a few graphs, however I get the following bug: the display window comes up for a microsecond and disappears, whereas terminal spits out the following: 'qt.qpa.fonts: Populating font family aliases took 260 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost.' -- Option 1.0 in code below

What I've tried: Tried multiple fixes, involving change of font i.e Option 1.1 in code below. Upon changing to Helvetica or Verdana, the error disappears, but there is no display window.

Any ideas on how to fix it?

So far, I can get the graphs saved using the png term -- Option 1.2, all other term seem to produce same error as with qt. Desired solution is to have a functional display window as to avoid opening the saved.png.

P.S Using Mac OS, version 10.15.4 Catalina. Same code used to work before on older OS and older version of Gnuplot with x11/aquaterm support, which is not supported by the current OS and brew install.

Thank you all in advance!!!

Some Code (gunplot zsh script attached below):

gnuplot  << EOF


# Option 1.0
set terminal qt
# does  Error in commant prompt: qt.qpa.fonts: Populating font family aliases took 252 ms. Replace uses of missing font family "Sans" with one that exists to avoid this cost.   

# Option 1.1 
#set terminal qt font "Helvetica" #  does no error in command prompt, no window displayed

# Option 1.2
#set terminal png
#set output 'saved.png' # saves .png but no window generated


# PARKER WIND
set xr [0.5:2.0]
set yr [0.0:2.5]

set xlabel "r/r_0"
set ylabel "Psi"



set style line 1 lt 1 lc rgb "blue" lw 1 pt 11   
set style line 2 lt 1 lc rgb "black" lw 1   pt 11
set style line 3 lt 1 lc rgb "black" lw 1 pt 7 ps 2
set style line 4 lt 1 lc rgb "blue" lw 1 pt 7 ps 2
set style line 5 lt 1 lc rgb "black" lw 3 pt 7 ps 2

set xzeroaxis



#        MULTIPLE GRAPHS
plot  'outputdata/parker_0.500.dat' u 1:2 with  lines ls 1 title "psi0=0.500"  ,\
      'outputdata/parker_0.550.dat' u 1:2 with  lines ls 1 title "psi0=0.550"  ,\
      'outputdata/parker_0.600.dat' u 1:2 with  lines ls 1 title "psi0=0.600"  ,\
      'outputdata/parker_0.650.dat' u 1:2 with  lines ls 1 title "psi0=0.650"  ,\
      'outputdata/parker_0.700.dat' u 1:2 with  lines ls 1 title "psi0=0.700" ,\
      'outputdata/parker_0.750.dat' u 1:2 with  lines ls 1 title "psi0=0.750" ,\
      'outputdata/parker_0.800.dat' u 1:2 with  lines ls 1 title "psi0=0.800" ,\
      'outputdata/parker_0.850.dat' u 1:2 with  lines ls 1 title "psi0=0.850" ,\


EOF

Solution

  • You need to tell gnuplot to "persist" your plot with the -p option:

    gnuplot -p <<EOF
    ...
    ...
    EOF
    

    You might also consider adding the following to your login script to always select qt output:

    export GNUTERM=qt