Class: Numo::Gnuplot::SPlotRecord

Inherits:
PlotData
  • Object
show all
Defined in:
lib/numo/gnuplot.rb

Instance Method Summary collapse

Methods inherited from PlotData

array_shape, #data_format, #data_str, #line_str

Constructor Details

#initialize(x, y, z) ⇒ SPlotRecord

:nodoc: all


905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
# File 'lib/numo/gnuplot.rb', line 905

def initialize(x,y,z)
  @text = false
  @data = [x,y,z].map{|a| a.flatten}
  @n = @data.map{|a| a.size}.min
  shape = PlotData.array_shape(z)
  if shape.size >= 2
    n = shape[1]*shape[0]
    if @n < n
      kernel_raise GnuplotError, "data size mismatch"
    end
    @n = n
    @record = "#{shape[1]},#{shape[0]}"
  else
    @record = "#{@n}"
  end
end

Instance Method Details

#cmd_strObject


922
923
924
925
926
927
928
# File 'lib/numo/gnuplot.rb', line 922

def cmd_str
  if @text
    "'-'"
  else
    "'-' binary record=(#{@record}) format='%float64' using 1:2:3"
  end
end