GR.rb icon indicating copy to clipboard operation
GR.rb copied to clipboard

Problems with arguments - Rdatasets example not work well.

Open kojix2 opened this issue 5 years ago • 2 comments

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...

kojix2 avatar Jun 03 '20 00:06 kojix2

To better understand the problem, I need to list the types of arguments for each function...

kojix2 avatar Aug 31 '20 05:08 kojix2

To better understand this problem, we need to break Example down into smaller pieces and make it more like a unit test.

kojix2 avatar Sep 17 '21 06:09 kojix2