In [1]:
require 'nyaplot'
Out[1]:
Out[1]:
true
In [2]:
path = File.expand_path("../data/11-1-result0.3.csv", __FILE__)
df = Nyaplot::DataFrame.from_csv(path)
Out[2]:
| t | v | w |
|---|---|---|
| 0.0 | 2.286944 | 4.001058 |
| 0.01 | 1.832105 | 3.996535 |
| 0.02 | 1.476517 | 3.988085 |
| 0.03 | 1.162703 | 3.976401 |
| 0.04 | 0.861662 | 3.961766 |
| 0.05 | 0.554821 | 3.944233 |
| 0.06 | 0.228388 | 3.923697 |
| 0.07 | -0.127566 | 3.899931 |
| 0.08 | -0.516677 | 3.872644 |
| 0.09 | -0.931057 | 3.841559 |
| 0.1 | -1.346455 | 3.806563 |
| 0.11 | -1.725502 | 3.767856 |
| 0.12 | -2.033541 | 3.726014 |
| 0.13 | -2.256013 | 3.681861 |
| 0.14 | -2.400905 | 3.636245 |
| 0.15 | -2.487638 | 3.589856 |
| ... | ... | ... |
| 99.99 | -0.993297 | -0.366622 |
In [3]:
Nyaplot.init_iruby
Out[3]:
In [4]:
plot1 = Nyaplot::Plot.new
plot2 = Nyaplot::Plot.new
plot3 = Nyaplot::Plot.new
colors=["#3182bd","#31a354"]
(3..4).each do |i|
path = File.expand_path("../data/11-1-result0." + i.to_s + ".csv", __FILE__)
df = Nyaplot::DataFrame.from_csv(path)
line1 = plot1.add_with_df(df, :line, 't', 'v')
line2 = plot2.add_with_df(df, :line, 't', 'w')
line3 = plot3.add_with_df(df, :line, 'v', 'w')
color=colors.pop
title="I0 ="+i.to_s
line1.color(color);line2.color(color);line3.color(color);
line1.title(title);line2.title(title);line3.title(title);
end
plot1.legend(true); plot2.legend(true); plot3.legend(true)
frame = Nyaplot::Frame.new
frame.add(plot1)
frame.add(plot2)
frame.add(plot3)
frame.show
Out[4]:
In [ ]: