Eruby templates for plots in R
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
templates
README.textile
histogram.rb
logloghist.rb
monthseries.rb
worldmap.rb
xyplot.rb

README.textile

Rplots

A collection of erubis templates for plotting with R and ruby.

Pre-requisites

You’ll need to install R:


# ubuntu
sudo apt-get install R

For mac os x try: http://cran.r-project.org/bin/macosx/. If the mac installer doesn’t already, symlink the Rscript executable to /usr/bin/Rscript.

Once R is installed, install ggplot2.


Rprompt$: install.packages("ggplot2")

Examples

Provided are some examples of using the templates with Swineherd. All examples make use of the configliere gem, thus using --help as an option should print options specific to that plot example.

XY plot


./xyplot.rb --points --width=800 --title="Henon Map" --point_size=0.01 data/henon.tsv

Histogram


./histogram.rb data/frequency.tsv

Log-Log Histogram


./logloghist.rb data/frequency.tsv

World Map


./worldmap.rb --lat=2 --lon=3 data/airports.tsv

Timeseries with Months

Often it is the case you’ve got timeseries of the form:


 201006 1234
 201007 5678
 ...

This transforms the month field into something R can understand and plots it with the right scaling.


./monthseries.rb --month=2 --y=3 --xlab="Month" --ylab="Passengers in + Passengers out" data/passengers_in_out_lax_airpt.tsv

More are on the way.