Plot all files in a directory simultanously with gnuplot?

前端 未结 4 2130
梦如初夏
梦如初夏 2020-12-17 19:34

I want to do something similar to this question: gnuplot : plotting data from multiple input files in a single graph.

I want to plot simultaneously all the

4条回答
  •  甜味超标
    2020-12-17 19:46

    You could try something like:

    a=system('a=`tempfile`;cat *.dat > $a;echo "$a"')
    plot a u 3:2
    

    This uses the command line tempfile command to create a safe, unique, and disposable temporary file. It mashes all of the data files into this file. It then echoes the file's name so gnuplot can retrieve it. Gnuplot then plots things.

    Worried about header lines? Try this:

    a=system('a=`tempfile`;cat *.dat | grep "^\s*[0-9]" > $a;echo "$a"')
    

    The regular expression ^\s*[0-9] will match all lines which begin with any amount of whitespace followed by a number.

提交回复
热议问题