Awesome
Ruby/MathGL
Ruby wrapper of MathGL, made using SWIG.
MathGL is a library for scientific data visualization developed by Alexey Balakin.
(This package is under construction.)
Installation
-
Install MathGL2 library: http://mathgl.sourceforge.net/
-
Install Ruby/MathGL from source:
ruby setup.rb config -- --with-mathgl-dir=/usr/local ruby setup.rb setup ruby setup.rb install
Or install with gem:
gem install mathgl -- --with-mathgl-dir=/usr/local
Usage
Write a plot to PNG file:
require 'mathgl'
prc = proc{
x = (0..100).map{|i| i*0.1}
y = x.map{|i| Math.sin(i)}
set_ranges(0,10,-1,1)
box
axis
plot(x,y)
}
gr = MathGL::MglGraph.new
gr.instance_eval(&prc)
gr.write_png("test.png","",false)
Display a plot on Qt window:
require 'mathgl'
prc = proc{
x = (0..100).map{|i| i*0.1}
y = x.map{|i| Math.sin(i)}
set_ranges(0,10,-1,1)
box
axis
plot(x,y)
}
qt = MathGL::MglQT.new(&prc)
qt.run
Version
- MathGL 2.3.3
- Ruby 2.3.0
- CentOS 7.2
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request