Created
July 12, 2015 04:46
-
-
Save komasaru/18575f0245952cae7d02 to your computer and use it in GitHub Desktop.
Ruby script to draw a graph by gnuplot.(Ex.1)
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
#! /usr/local/bin/ruby | |
#----------------------------------------------- | |
# Ruby script to draw a graph by gnuplot.(Ex.1) | |
#----------------------------------------------- | |
require 'gnuplot' | |
Gnuplot.open do |gp| | |
Gnuplot::Plot.new(gp) do |plot| | |
plot.xrange "[-10:10]" | |
plot.title "作成例1" | |
plot.xlabel "x" | |
plot.ylabel "y" | |
plot.grid | |
plot.data << Gnuplot::DataSet.new("sin(x)") do |ds| | |
ds.with = "lines" | |
ds.linewidth = 2 | |
end | |
plot.data << Gnuplot::DataSet.new("cos(x)") do |ds| | |
ds.with = "lines" | |
ds.linewidth = 2 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment