• plotting 2 files with 2 different datafile separators

    From Jean-Pierre Coulon@21:1/5 to All on Wed Jun 10 13:07:17 2020
    In on file the data spaces are separated by a space and in the other one they are separated with <tab>, requiring set datafile separator "\t".

    How can I say plot "file1.txt", "file2.txt", to be compatible with both?

    --
    Jean-Pierre Coulon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to Jean-Pierre Coulon on Wed Jun 10 14:03:03 2020
    On 10.06.2020 13:07, Jean-Pierre Coulon wrote:
    In on file the data spaces are separated by a space and in the other one
    they are separated with <tab>, requiring set datafile separator "\t".

    How can I say plot "file1.txt", "file2.txt", to be compatible with both?


    Here the default "whitespace" works with both separators (Tabulator and
    Space).

    set datafile separator whitespace

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Olaf Schultz@21:1/5 to Jean-Pierre Coulon on Wed Jun 10 13:55:20 2020
    On 6/10/20 1:07 PM, Jean-Pierre Coulon wrote:
    In on file the data spaces are separated by a space and in the other one
    they are separated with <tab>, requiring set datafile separator "\t".

    How can I say plot "file1.txt", "file2.txt", to be compatible with both?


    Have you just tried it? Since I'am using now 20+ years I never had
    problems with Space and \t as separator... neither in same file nor in different files.

    Greetings,

    Olaf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jean-Pierre Coulon@21:1/5 to All on Wed Jun 10 15:43:02 2020
    On Wed, 10 Jun 2020, Jörg Buchholz wrote:

    Here the default "whitespace" works with both separators (Tabulator and Space).

    set datafile separator whitespace

    In my second file I have: set timefmt "%d/%m/%Y %H:%M:%S" and now when I plot the second file using 1:2 gnuplot believes the hour field is my second
    column. Same with 1:3.

    I know how to workaround with multiplot but I thought it could be simpler.

    --
    Jean-Pierre Coulon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to Jean-Pierre Coulon on Thu Jun 11 07:11:22 2020
    On 10.06.2020 15:43, Jean-Pierre Coulon wrote:
    On Wed, 10 Jun 2020, Jörg Buchholz wrote:

    Here the default "whitespace" works with both separators (Tabulator and
    Space).

    set datafile separator whitespace

    In my second file I have: set timefmt "%d/%m/%Y %H:%M:%S" and now when I
    plot the second file using 1:2 gnuplot believes the hour field is my
    second column. Same with 1:3.

    I know how to workaround with multiplot but I thought it could be simpler.


    There will be more than one solution. My solution is, bring both files
    to the same separator. With "sytem" you can do it from inside gnuplot.


    system "sed -i 's/\ /\t/g' sep_space.dat"
    set datafile separator "\t"
    plot 'sep_tab.dat' u 1:2 w lp, 'sep_space.dat' u 1:2 w lp



    This "sed -i 's/\ /\t/g' sep_space.dat" convert the space into a
    tabulator, in the file "sep_space.dat".

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jean-Pierre Coulon@21:1/5 to All on Thu Jun 11 08:21:07 2020
    On Thu, 11 Jun 2020, Jrg Buchholz wrote:

    I know how to workaround with multiplot but I thought it could be simpler. >>

    There will be more than one solution. My solution is, bring both files
    to the same separator. With "sytem" you can do it from inside gnuplot.

    Thanks, but I am with Windows. But I know how to process either file in Fortran. Or I'll ask the enthusiast who provided the files to standardize either one :-)

    --
    Jean-Pierre Coulon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Olaf Schultz@21:1/5 to Jean-Pierre Coulon on Thu Jun 11 09:18:21 2020
    On 6/11/20 8:21 AM, Jean-Pierre Coulon wrote:
    On Thu, 11 Jun 2020, Jrg Buchholz wrote:

    I know how to workaround with multiplot but I thought it could be
    simpler.


    There will be more than one solution. My solution is, bring both files
    to the same separator. With "sytem" you can do it from inside gnuplot.

    Thanks, but I am with Windows. But I know how to process either file in Fortran. Or I'll ask the enthusiast who provided the files to
    standardize either one :-)


    install cygwin and then use gnuplot there... sed and awk and gnuplot are available under cygwin.

    Greetings,

    Olaf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to Olaf Schultz on Thu Jun 11 11:37:12 2020
    On 11.06.2020 09:18, Olaf Schultz wrote:
    On 6/11/20 8:21 AM, Jean-Pierre Coulon wrote:
    On Thu, 11 Jun 2020, Jörg Buchholz wrote:

    I know how to workaround with multiplot but I thought it could be
    simpler.


    There will be more than one solution. My solution is, bring both files
    to the same separator. With "sytem" you can do it from inside gnuplot.

    Thanks, but I am with Windows. But I know how to process either file in
    Fortran. Or I'll ask the enthusiast who provided the files to
    standardize either one :-)


    install cygwin and then use gnuplot there... sed and awk and gnuplot are available under cygwin.

    I have a mix of both. On Windows I use the "Win-Gnuplot" and cygwin to
    have these nice helpers from the linux/unix world.

    Here is another solution with only gnuplot.

    set datafile separator whitespace
    set table 'space2tab.dat' separator tab
    plot 'sep_space.dat' u 1:2 w table
    set datafile separator "\t"
    unset table
    plot 'sep_tab.dat' w p, 'space2tab.dat' w p


    Then you have a second dataset (sep_space.dat -> space2tab.dat) with
    tabulator instead space separators. It works since version 5.2.2.


    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Karl Ratzsch@21:1/5 to All on Thu Jun 11 21:24:47 2020
    Am 10.06.2020 um 15:43 schrieb Jean-Pierre Coulon:
    On Wed, 10 Jun 2020, Jörg Buchholz wrote:

    Here the default "whitespace" works with both separators
    (Tabulator and
    Space).

    set datafile separator whitespace

    In my second file I have: set timefmt "%d/%m/%Y %H:%M:%S" and now
    when I plot the second file using 1:2 gnuplot believes the hour
    field is my second column. Same with 1:3.

    I know how to workaround with multiplot but I thought it could be
    simpler.

    The timeformat specifier should win against any datafile separator.
    At least I was pretty sure it used to. That however doesn´t seem to
    be the case both in gp5.3rc1 and 4.6.6. Hmmm ....


    $dat << EOD
    03/04/2020 14:14:14 654
    03/04/2020 15:15:15 543
    03/04/2020 16:16:16 654
    EOD

    #set dataf sep ...

    set xdata time
    set timefmt "%d/%m/%Y %H:%M:%S"
    plot $dat us (timecolumn(1)):3 w lp ps 3

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to Karl Ratzsch on Sat Jun 13 20:59:47 2020
    On 11.06.20 21:24, Karl Ratzsch wrote:
    Am 10.06.2020 um 15:43 schrieb Jean-Pierre Coulon:
    On Wed, 10 Jun 2020, Jörg Buchholz wrote:

    Here the default "whitespace" works with both separators
    (Tabulator and
    Space).

    set datafile separator whitespace

    In my second file I have: set timefmt "%d/%m/%Y %H:%M:%S" and now
    when I plot the second file using 1:2 gnuplot believes the hour
    field is my second column. Same with 1:3.

    I know how to workaround with multiplot but I thought it could be
    simpler.

    The timeformat specifier should win against any datafile separator.
    At least I was pretty sure it used to. That however doesn´t seem to
    be the case both in gp5.3rc1 and 4.6.6. Hmmm ....


    $dat << EOD
    03/04/2020 14:14:14 654
    03/04/2020 15:15:15 543
    03/04/2020 16:16:16 654
    EOD

    #set dataf sep ...

    set xdata time
    set timefmt "%d/%m/%Y %H:%M:%S"
    plot $dat us (timecolumn(1)):3 w lp ps 3


    Thanks to point this out, this can result in less work. GP 5.0.5 Debian Stretch.

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)