How to Write to Stdout with Gnuplot's Print Statement?

How to Write to Stdout with Gnuplot's Print Statement?

When I use the following in my script, gnuplot will print test to stderr:

print "test"

However, I want to write test to stdout as only errors should be written to stderr.

1 Answer

As stated in the gnuplot docs (type help print in interactive gnuplot console):

The output file can be set with set print.

So, let's look up set print:

Without "<filename>", the output file is restored to <STDERR>. The <filename> "-" means <STDOUT>.

So simply add a set print "-" at the top of your gnuplot script and everything printed by the print-statement is written to stdout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.