Created
January 24, 2019 07:31
-
-
Save astellon/cd84538b826d9e86b52cd6b14cde2dd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Plot | |
gnuplot = Process.new(command: "gnuplot", input: Process::Redirect::Pipe, output: Process::Redirect::Inherit) | |
input = gnuplot.input | |
# file out | |
input << "set terminal png\n" | |
input << "set output \'sin.png\'\n" | |
# plot | |
input << "set xrange [-10:10]\n" | |
input << "set yrange [-1:1]\n" | |
input << "plot sin(x)\n" | |
#exit | |
input << "exit\n" | |
input.flush | |
input.close | |
gnuplot.wait | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment