0

Hi I'm using gnuplot to create a large number of graphs. To save myself work I've written a script that tries to plot all possible graphs.

#!/usr/bin/gnuplot

reset
is_missing(x)=system("./ismissing.sh ".x)
set terminal post eps enhanced color
set key inside right top vertical Right noreverse enhanced autotitles box linetype -1 linewidth 1.000
set grid
models="Cebeci-Smith Baldwin-Lomax Spalart-Allmaras Launder-Sharma Chien"
files="./CebeciOut/ ./BaldwinOut/ ./SpalartOut/ ./LaunderOut/ ./ChienOut/"
xgrid="35000 70000 140000 280000 560000"

# Plot grid convergence Spalart
do for [f=1:words(files)]{
    set output sprintf('%s%s',word(files,f),'ZPGGridConvergence.eps')
    set title sprintf("%s%s",word(models,f), " ZPG Grid Convergence")
    set xlabel "N_y"
    set ylabel "C_f Final"
    print f
    do for [i=1:words(xgrid)]{
        filename=sprintf("%s%s%s%s",word(files,f),'yconv_',word(xgrid,i),"x")
        if(is_missing(filename)==0){
            plot filename using 1:2 title sprintf("%s%s",word(xgrid,i), " X Gridpoints") with linespoints
        }
    }
}

Unfortunately I have a problem, after one full iteration the script fails, ie f is never made 2 despite the first plots completing successfully. The error given is

cannot open file; output not changed
line 25: util.c: No such file or directory

which I haven't managed to decipher. Any help would be much appreciated. Also is there a way to use replot in this loop given I haven't already created a plot. Thanks

1 Answer 1

1

"files" are actually dirs in your code.

If you want to place the output in a subdir, then make sure that it exists and is writable.

gnuplot cannot create subdirs automatically. You can add system("mkdir -p ".word(files,f)) ( on linux/unix) in your code to create the directory if needed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.