x = Array(Float64).new(100){ rand(10.0..20.0) } y = Array(Float64).new(100){ rand(100.0..200.0) } Gnuplot.plot do |s| s << "set title 'SCATTER'" s << "plot '-' pt 6 lt rgb 'red' t 'circle'" s << to_gp([x, y]) end memo = 0 x = Array(Float64).new(100,0.0) 100.times do |i| memo = memo + rand(-0.9..1.0) x[i] = memo end Gnuplot.plot do |s| s << "set title 'LINES'" s << "plot '-' with lines title 'x'" s
![Crystalでgnuplot実行するの作ったった - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/a3054a9fe763f1b86f340b99ad8c6cc113010ac1/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-9f5428127621718a910c8b63951390ad.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9Q3J5c3RhbCVFMyU4MSVBN2dudXBsb3QlRTUlQUUlOUYlRTglQTElOEMlRTMlODElOTklRTMlODIlOEIlRTMlODElQUUlRTQlQkQlOUMlRTMlODElQTMlRTMlODElOUYlRTMlODElQTMlRTMlODElOUYmdHh0LWNvbG9yPSUyMzIxMjEyMSZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT01NiZ0eHQtY2xpcD1lbGxpcHNpcyZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZzPTFmY2VmMmNlNWZjYjMzMjk5YjQyMjM2YTZiYTBkNTQ1%26mark-x%3D142%26mark-y%3D112%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTYxNiZ0eHQ9JTQwa29qaXgyJnR4dC1jb2xvcj0lMjMyMTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz0yYjc2MDE0NTNkNTdkNjUwY2QyODc4MzNjNTJkMzU2Zg%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3D26f648ba50bf86123a59ea83cffc557c)