GR.rb
GR.rb copied to clipboard
Problems with arguments - Rdatasets example not work well.
This is not a problem with rdatasets.
Rather, it is a problem with format_xyzc method.
https://github.com/red-data-tools/GR.rb/blob/3657a0367021d44d969082b45bd254d9b5218464/lib/gr/plot.rb#L1369
When you pass 2d ruby array as Z to methods like contour contourf, it will not work as expected.
contourf(Z) # z is 2d ruby array or 2d numo array.
contourf(X,Y,Z) # x, y, z are 1d ruby array or 1d numo array.
This issue is complicated because sometimes these methods get multiple series.
contourf([Z,Z,Z])
contourf([[X,Y,Z],[X,Y,Z],[X,Y,Z]])
It is impossible to distinguish contourf([[X,Y,Z],[X,Y,Z],[X,Y,Z]]) from contourf(Z).
Maybe I have to reconsider APIs...
To better understand the problem, I need to list the types of arguments for each function...
To better understand this problem, we need to break Example down into smaller pieces and make it more like a unit test.