In [1]:
require 'nyaplot'
Out[1]:
Out[1]:
true
In [2]:
path = File.expand_path("../data/11-2-result0.01.csv", __FILE__)
df = Nyaplot::DataFrame.from_csv(path)
Out[2]:
| t | v | w |
|---|---|---|
| 0.0 | -0.756836 | 3.812226 |
| 0.1 | -0.04511 | 3.40354 |
| 0.2 | -2.017709 | 3.075507 |
| 0.3 | 1.709506 | 2.679731 |
| 0.4 | 0.570858 | 2.645426 |
| 0.5 | -1.100874 | 2.490375 |
| 0.6 | -1.278126 | 2.191405 |
| 0.7 | -1.328045 | 1.913642 |
| 0.8 | -1.514909 | 1.661195 |
| 0.9 | -1.572689 | 1.425256 |
| 1.0 | -1.658116 | 1.211392 |
| 1.1 | -1.690351 | 1.016707 |
| 1.2 | -1.664759 | 0.841834 |
| 1.3 | -1.597433 | 0.686942 |
| 1.4 | -1.511524 | 0.551852 |
| 1.5 | -1.416929 | 0.435926 |
| ... | ... | ... |
| 100.0 | 1.432378 | 1.528758 |
In [4]:
plot1 = Nyaplot::Plot.new
plot2 = Nyaplot::Plot.new
plot3 = Nyaplot::Plot.new
colors=["#3182bd","#31a354"]
["1.0","0.1"].each do |str|
path = File.expand_path("../data/11-2-result" + str + ".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 ="+str
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 [ ]: