From 305489d591bbded15720822bc872d7b8edcdb600 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Sat, 1 Aug 2020 22:57:49 +0900 Subject: [PATCH] Fix transpose2 --- lib/uplot/command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index 943020a..f2f36a7 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -96,7 +96,7 @@ module Uplot # Note: How can I transpose different sized ruby arrays? # https://stackoverflow.com/questions/26016632/how-can-i-transpose-different-sized-ruby-arrays def transpose2(arr) # Should be renamed - arr[0].zip(*arr[1..-1]) + Array.new(arr.map(&:length).max) { |i| arr.map { |e| e[i] } } end def preprocess(input)