lib/annlat/plot.rb
def plot(points = [], points2 = [])
    Gnuplot.open do |gp|
      Gnuplot::Plot.new(gp) do |plot|
    
        min_x = (points + points2).min - 1
        max_x = (points + points2).max + 1

        plot.terminal "pngcairo"
        plot.output @parameters[:fn]

        plot.style  "data boxplot"
        plot.unset "xtics"
        plot.grid "y2tics lc rgb \"#888888\" lw 1 lt 0"
        plot.yrange "[#{min_x}:#{max_x}]"
        plot.y2range "[#{min_x}:#{max_x}]"

        plot.xrange "[0.6:2]"
        plot.x2range "[0.6:2]"

        plot.y2tics "center rotate by 90 font \",15\""
        plot.unset "ytics"

        x = []
        y = []

        (min_x..max_x).to_a.each do |current_x|
            points.grep(current_x).size.times do
            x << 1
            y << current_x
          end if points.grep(current_x).size
        end

        x2 = []
        y2 = []
        (min_x..max_x).to_a.each do |current_x|
            points2.grep(current_x).size.times do
            x2 << 1.6
            y2 << current_x
          end if points2.grep(current_x).size
        end
        
        plot.data = [
          Gnuplot::DataSet.new([x, y]) { |ds|
            ds.title = ''
          },

          Gnuplot::DataSet.new([x2, y2]) { |ds|
            ds.title = ''
            ds.linecolor = "rgb \"red\""
          }
        ]

        label_index = 1
        @labels ||= []
        @labels.each do |l|
          plot.label "#{label_index} '#{l[0]}' at #{l[1]}, #{l[2]} font 'Latin-Modern,#{l[3]}' tc rgb '#{l[4]}' rotate by 90 center"
          label_index += 1
        end

      end
    end
    `convert -rotate 90 #{@parameters[:fn]} #{@parameters[:fn]}`
    @parameters[:fn]
  end
# points is an array of values to plot on the number line
points is an array of values to plot on the number line
points is an array of values to plot on the number line
def plot(points = [], points2 = [])
    Gnuplot.open do |gp|
      Gnuplot::Plot.new(gp) do |plot|
        min_x = (points + points2).min - 1
        max_x = (points + points2).max + 1
        plot.terminal "pngcairo"
        plot.output @parameters[:fn]
        plot.style  "data boxplot"
        plot.unset "xtics"
        plot.grid "y2tics lc rgb \"#888888\" lw 1 lt 0"
        plot.yrange "[#{min_x}:#{max_x}]"
        plot.y2range "[#{min_x}:#{max_x}]"
        plot.xrange "[0.6:2]"
        plot.x2range "[0.6:2]"
        plot.y2tics "center rotate by 90 font \",15\""
        plot.unset "ytics"
        x = []
        y = []
        (min_x..max_x).to_a.each do |current_x|
            points.grep(current_x).size.times do
            x << 1
            y << current_x
          end if points.grep(current_x).size
        end
        x2 = []
        y2 = []
        (min_x..max_x).to_a.each do |current_x|
            points2.grep(current_x).size.times do
            x2 << 1.6
            y2 << current_x
          end if points2.grep(current_x).size
        end
        plot.data = [
          Gnuplot::DataSet.new([x, y]) { |ds|
            ds.title = ''
          },
          Gnuplot::DataSet.new([x2, y2]) { |ds|
            ds.title = ''
            ds.linecolor = "rgb \"red\""
          }
        ]
        label_index = 1
        @labels ||= []
        @labels.each do |l|
          plot.label "#{label_index} '#{l[0]}' at #{l[1]}, #{l[2]} font 'Latin-Modern,#{l[3]}' tc rgb '#{l[4]}' rotate by 90 center"
          label_index += 1
        end
      end
    end
    `convert -rotate 90 #{@parameters[:fn]} #{@parameters[:fn]}`
    @parameters[:fn]
  end
def plot ( points = [ ] , points2 = [ ] ) Gnuplot . open do | gp | Gnuplot :: Plot . new ( gp ) do | plot | min_x = ( points + points2 ) . min - 1 max_x = ( points + points2 ) . max + 1 plot . terminal "pngcairo" plot . output @parameters [ :fn ] plot . style "data boxplot" plot . unset "xtics" plot . grid "y2tics lc rgb \"#888888\" lw 1 lt 0" plot . yrange "[#{min_x}:#{max_x}]" plot . y2range "[#{min_x}:#{max_x}]" plot . xrange "[0.6:2]" plot . x2range "[0.6:2]" plot . y2tics "center rotate by 90 font \",15\"" plot . unset "ytics" x = [ ] y = [ ] ( min_x .. max_x ) . to_a . each do | current_x | points . grep ( current_x ) . size . times do x << 1 y << current_x end if points . grep ( current_x ) . size end x2 = [ ] y2 = [ ] ( min_x .. max_x ) . to_a . each do | current_x | points2 . grep ( current_x ) . size . times do x2 << 1.6 y2 << current_x end if points2 . grep ( current_x ) . size end plot . data = [ Gnuplot :: DataSet . new ( [ x , y ] ) { | ds | ds . title = '' } , Gnuplot :: DataSet . new ( [ x2 , y2 ] ) { | ds | ds . title = '' ds . linecolor = "rgb \"red\"" } ] label_index = 1 @labels ||= [ ] @labels . each do | l | plot . label "#{label_index} '#{l[0]}' at #{l[1]}, #{l[2]} font 'Latin-Modern,#{l[3]}' tc rgb '#{l[4]}' rotate by 90 center" label_index += 1 end end end ` convert -rotate 90  #{ @parameters [ :fn ] } #{ @parameters [ :fn ] } ` @parameters [ :fn ] end
points is an array of values to plot on the number line
points is an array of values to plot on the number line
points
points2