ruby candlesticks graphs [percentiles, quartiles]

using gnuplot ! [gnuplot gem]
straight from the gnuplot candlesticks demo [demo/candlesticks.dem]

rdp@rdp-vm:~/Downloads/gnuplot-4.2.5/demo$ cat test.rb
# 1	1.5	2 	2.4	4	6.
# 2	1.5	3 	3.5	4	5.5
# 3	4.5	5 	5.5	6	6.5
a = [1,2,3]
b = [1.5, 1.5, 4.5]
c = [2,3,5]
d = [2.4, 3.5, 5.5]
e = [4,4,6]
f = [6,5.5, 6.5] 
require 'rubygems'
require 'gnuplot'
Gnuplot.open do |gp|
  Gnuplot::Plot.new( gp ) do |plot|
  
    plot.title  "Example"
    plot.ylabel "x"
    plot.xlabel "x^2"
    plot.xrange "[0:11]"
    plot.yrange "[0:10]"

    plot.data << Gnuplot::DataSet.new( [a,b,c,d,e,f] ) do |ds|
      ds.using = "1:3:2:6:5"
      ds.with = "candlesticks lt 3 lw 2 title 'Quartiles' whiskerbars"
      #ds.notitle
    end

    plot.data << Gnuplot::DataSet.new( [a,b,c,d,e,f] ) do |ds|
      ds.using = "1:4:4:4:4"
      ds.with = "candlesticks lt -1 lw 2"
      ds.notitle
    end

  end
end

ruby tape woe

reading from a tape, then again, resulted in

irb(main):010:0> b = File.new ‘/dev/nst0′, ‘r’

Errno::EBUSY: Device or resource busy – /dev/nst0

from (irb):10:in `initialize’

from (irb):10:in `new’

from (irb):10

from :0

fix:

close the first handle [though it's already past EOF, apparently it needs a local close, too]

irb(main):011:0> a.close

=> nil

note you’ll want to read in chunks of 64*1024, even if it doesn’t actually return you chunks of that size, for some odd reason

how to add files to an rdoc command line and specify a main for a gem’s rdocs rubygems

I think once upon a time you did it like

rdoc some_files FILES=README.txt

but now it’s

rdoc README.txt some_files

[?]

This appears to break gem rdocs

gem rdocs need to specify this via

s.rdoc_options = ["--title", "EventMachine", "--main", "README", "--line-numbers"]

and

s.extra_rdoc_files = ["README", "RELEASE_NOTES", "COPYING", "GNU", "LEGAL", "TODO"]

see eventmachine-win32′s gemspec for an example