Class: Numo::Gnuplot::RgbAlphaData

Inherits:
ImageData show all
Defined in:
lib/numo/gnuplot.rb

Instance Method Summary collapse

Methods inherited from ImageData

#cmd_str, #data_str

Methods inherited from PlotData

array_shape, #as_array, #cmd_str, #data_format, #data_str, #line_str, quote_data

Constructor Details

#initialize(data) ⇒ RgbAlphaData

:nodoc: all



1063
1064
1065
1066
1067
1068
1069
# File 'lib/numo/gnuplot.rb', line 1063

def initialize(data)
  if data.kind_of?(Numo::NArray)
    super(data)
  else
    super(Numo::NArray[*data])
  end
end

Instance Method Details

#check_shapeObject



1071
1072
1073
1074
1075
1076
1077
1078
1079
# File 'lib/numo/gnuplot.rb', line 1071

def check_shape
  if @data.shape.size != 3
    raise IndexError,"array should be 2-dimensional"
  end
  if @data.shape[2] != 4
    raise IndexError,"shape[2] (last dimension size) must be 4"
  end
  @shape = @data.shape
end