How to implement mutiple plot. Argument problems.
kojix2 opened this issue · 6 comments
2020 03-05, GR.rb, partially supports multiple plots.
I haven't implemented oplot
yet.
GR.jl x1, y1, x2, y2.
GR.rb [x1, y1] , [x2, y2]
This is an idea inspired by numo-gnuplot.
GR.jl has functions that parse arguments, but GR.rb does not.
I don't think the GR.jl approach should be introduced into GR.rb. Ruby and Julia are different languages. But there is something that GR.rb needs to improve.
I feel GR.rb [x1, y1] , [x2, y2]
is natural. x-y relation is clear.
As you may know, in numo-gnuplot, both styles are available:
plot [x1,y1,{}], [x2,y2,{}]
plot x1,y1,{}, x2,y2
https://github.com/ruby-numo/numo-gnuplot/wiki/Introduction.ja (in Japanese)
A multiplot example is here...
https://github.com/red-data-tools/GR.rb/blob/master/examples/bessel.rb
I changed my mind.
I think the GR.jl way is reasonable now.
I will be porting GR.jl's approach to GR.rb soon...
plot | ? | plot_args |
---|---|---|
oplot | ? | plot_args |
step | xyac | plot_args |
scatter | xyac | plot_args |
stem | ? | plot_args |
barplot | ? | args |
histogram | ? | args |
polarhistogram | ? | args |
contour | xyzc | plot_args |
contourf | xyzc | plot_args |
hexbin | ? | plot_args |
heatmap | ? | args |
polarheatmap | ? | args |
wireframe | xyzc | plot_args |
surface | xyzc | plot_args |
volume | ? | afgs |
plot3 | xyzc | plot_args |
scatter3 | xyzc | plot_args |
redraw | - | - |
title | - | - |
xlabel | - | - |
ylabel | - | - |
legend | - | - |
xlim | - | - |
ylim | - | - |
savefig | - | - |
meshgrid | - | - |
peaks | - | - |
imshow | ? | args |
isosurface | ? | args |
cart2sph | - | - |
sph2cart | - | - |
polar | ? | plot_args |
trisurf | xyzc | plot_args |
tricont | xyzc | plot_args |
shade | xys | plot_args |
setpanzoom | - | - |
I tried to implement... but gave up!
My math and programming skills are not high.
I will make bugs. And nobody will be happy.
The current approach is simple, so bugs are less likely to appear.
It's not very cool. But I will continue this way.
The problem is spec
s.
If there is a character string at the end of the array, GR.rb process it as a spec.
GR.plot( x, y, "s" )
GR.plot( [x, y, "d"], [x, y2, "s"] )
Also, I prepare spec
keyword argument.
GR.plot(x, y, spec: "s")
GR.plot([x, y, spec: "s"])