An advanced plotting library for Ruby.
Rubyplot aims to be the most advanced visualization solution for Rubyists.
It aims to allow you to visualize anything, anywhere with a flexible, extensible, Ruby-like API.
Rubyplot can use different backends to render its plots:
magick
Using ImageMagickgr
Using the GR frameworktk_canvas
Interactive drawing in a Canvas object using Ruby/Tk
Call Rubyplot.set_backend
at the start of your program to select
the desired backend.
Pick the desired one:
Rubyplot.set_backend(:magick)
Rubyplot.set_backend(:gr)
Rubyplot.set_backend(:tk_canvas)
Install the GR framework from the website.
Then set the GRDIR
and GKS_FONTPATH
ENV variables to point to your GR installation
and GR font path. Set the RUBYPLOT_BACKEND
ENV variable to "GR". For example:
export GRDIR="/home/sameer/Downloads/gr"
export GKS_FONTPATH="/home/sameer/Downloads/gr"
export RUBYPLOT_BACKEND="GR"
This gem is not including tk
in its dependencies so you don't have
to install it if you're not going to use the tk_canvas
backend.
If you will need to use this backend, you will need to add a reference
to tk
in your Gemfile
in addition to referring to rubyplot
.
gem 'tk'
Running bundle install
after this change will install it.
In addition to install the tk
gem in your project, you need to
install the Tcl/Tk runtime in your system. The instructions depending
on the OS but it is a safe bet to install the Community Edition of
Active Tcl from https://www.activestate.com/
You have more details about installing Tk in different systems in the excelent TkDocs website.
If you want to have a more modern way of interacting with Tk from Ruby, you can use TkComponent and TkInspect.
See the examples to see some how-to code.
Check milestones in GitHub for more information.
Rubyplot's long term vision, by priority:
- Integrate the Rubyplot interface with the GR framework.
- Generate various types of publication quality plots.
- Interactive plotting using QT/GTK.
- Integrate with bokehjs (or some other web framework) for plotting in the web browser.
The library is currently in alpha stage. Version 0.1.0
is designated to be the
first 'final' release. Until then we will utilize various numbering schemes in the
third position of the version number to denote alpha, beta and RC releases. They
are as follows:
a
foralpha
. For example0.1-a1
is the first alpha release.b
forbeta
. For example0.1-b1
is the first beta release.rc
forRC
. For example0.1-rc1
is the first RC release.