You can install matplotlib by gem install --pre matplotlib.
matplotlib.gem depends on pycall.gem so you don't need to install pycall explicitly.
You should call Matplotlib::IRuby.activate method defined in matplotlib/iruby to prepare the integration between IRuby and matplotlib.
This method defines Matplotlib::Pyplot module that has singleton methods connected to functions defined in matplotlib.pyplot module in Python-side.
Also, this method defines the way to display matplotlib's figure as an output of execution. When you display the current figure, you can call Matplotlib::Pyplot.gcf method at the end of the code cell.
In [1]:
require 'matplotlib/iruby'
Matplotlib::IRuby.activate
plt = Matplotlib::Pyplot
Out[1]:
In [2]:
plt.plot([1, 2, 3, 4, 5], [1, 2, 3, 1, 2])
Out[2]:
Out[2]:
In [3]:
# Multiple plots in a figure
plt.plot([1, 2, 3, 4, 5], [1, 2, 3, 1, 2])
plt.plot([10, 20, 30, 40, 50], [1, 2, 3, 1, 2])
Out[3]:
Out[3]:
In [4]:
# Multiple figures
plt.figure()
plt.plot([1, 2, 3, 4, 5], [1, 2, 3, 1, 2])
plt.figure()
plt.plot([10, 20, 30, 40, 50], [1, 2, 3, 1, 2])
Out[4]:
Out[4]:
Out[4]:
In [ ]: