View on GitHub

Rubyplots

An open source plotting tool for Ruby.

Download this project as a .zip file Download this project as a tar.gz file

About

RubyPlots is a PgfPlots (Latex) wrapper for Ruby that is all about generating stupid simple plots from data files.

The idea is that for straightforward data-to-graphic visualizations, prerequisits should be kept to a minimum and ease of use to a maximum.

The engine driving the visualizations is PdfLatex + PdfPlots. Ruby plots basically takes your data and writes some latex around it, compiles the latex and extracts the graphs. And of course, like all good utilities, RubyPlots cleans up after itself removing all latex related cruft and leaving pdf's of your data (one for each data file).

Right now RubyPlots is in its infancy and is therefore functionality limited but, as all infants do, it is growing. Help is welcome in the growth of this project and therefore feel free to issue a pull request. Contributions are always welcome and much appreciated.

Prerequisites

There are two major Latex prerequisites for using RubyPlots. Both of the following must be installed and executable from the commandline:

On Unix this can be tested with:

$which pdflatex
$kpsewhich pgfplots
RubyPlots uses a variation of these commands to check and execute latex so it is critical that they are available. If they are not RubyPlots can't be initialized and an error will be generated.

Installation


$ gem install rubyplots

License

MIT

Status

Current project status can be found on the 'Work In Progress' wiki page (in the github repo - this will eventually be moved here.).

Usage

There are several requirements for RubyPlots to work on your data.

  1. You must have the following installed: PdfLatex with the Tikz and PfgPlots packages.
  2. You must save any files you want data generated for with the extension '.scatterplot'
  3. You must save the data in tab seperated format obeying the following:
    • The first row of the file represents the column names (x and y columns).
    • Each column name will be displayed on the plot as 'axis labels' so name your columns accordingly.
    • Columns with multiple word names should be encolsed in brackets '{' '}'
    • Each 'point' on the plot should be represented by one row in the data file.
Once the above requirements are met it is as simple as the following in an IRB session:

$ require 'rubyplots'
$ plotter = RubyPlots.new
$ plotter.generatePlotsFor "./"
Note that './' represents the directory containing the data files. This will generate a pdf file with the same name as your data file, prefixed with 'rubyplots-'.