scbi_plot

DESCRIPTION:

scbi_plot is a simplified wrapper to create plots with gnuplot.

FEATURES/PROBLEMS:

  • Create histogram plots with numeric or string x axis

  • Create line and related plots (linespoints, points, impulses, etc…)

SYNOPSIS:

Histogram plot:

# create Histogram
p=ScbiPlot::Histogram.new('with_string_axis.png','title')

# add x axis data
p.add_x(['a','b','c'])

# add y axis data
p.add_y([10,20,30])

# generate graph
p.do_graph

Line plot:

# Create lines plot
p=ScbiPlot::Lines.new('lines.png','title')

# create some random data
x=[]
y1=[]
y2=[]
y3=[]

10.times do |i|
  x.push i*10
  y1.push i+(rand*50).to_i
  y2.push i+(rand*50).to_i
  y3.push i+(rand*50).to_i
end

# add x data
p.add_x(x)

# add a series
p.add_series('serie0', y1)

# draw another series with points
p.add_series('serie1', y2, 'points')

# add a third series with impulses of width 4
p.add_series('serie2', y3,'impulses',4)

# add a vertical line at pos 5
p.add_vertical_line('label',5)

# create graph
p.do_graph

REQUIREMENTS:

  • gnuplot binary

  • gnuplot gem

INSTALL:

  • gem install scbi_plot

LICENSE:

(The MIT License)

Copyright © 2011 Dario Guerrero

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.