"heredoc" DATA

Information Summary

Heredoc is not a command. It is a method for entering data from the terminal which Gnuplot can use as if it were reading from a file. Naturally this is not practical for large data sets. But is useful for entering a few vectors and similar simple data. Heredoc is very sensitive, so you must be careful especially with the start and end tags.

$data <<EOF
0 0 1 1
0 0 2 3

$data is the name you will use when otherwise Gnuplot expects a file name. The capital letters EOF only serve as markers for the beginning and end of the data. They must not occur within the data. They could be EOD or PIT, all that matters is that the letters with the << match exactly with the three letters at the very beginning of the line which signify the end of the data.

Then you can use it in a Gunplot command where you would put the input filename.

plot $data u 1:2:3:4 w vectors

It is up to you have the data the Gnuplot is expecting in the order it would expect to read it from a file.

Heredoc will keep reading lines as if they were data until it finds the exact three letters at exactly the beginning of a new line. You can mess up your terminal if you don't match the letters at the end.

<< set terminal | Gnuplot Command Trail | plot >>


gnuplot 4.2 Copyright (C) 1986 - 1993, 1998, 2004, 2007 Thomas Williams, Colin Kelley
Permission to use, copy, and distribute this software and its documentation for any purpose with or without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.


Categories: Gnuplot Commands



This is a student's notebook. I am not responsible if you copy it for homework, and it turns out to be wrong.


This page is GnuplotCommand5