gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

plot_3d #203

Open slayoo opened 6 years ago

slayoo commented 6 years ago

As reported by Michel Perault on SF.net (https://sourceforge.net/p/gnudatalanguage/feature-requests/148/):

Hi, following a recent exchange with Alain C. it turned out that plot_3d would be a nice function to have.
As an example the python matplotlib-3d library has a nice scatter plot implementation:
https://pythonprogramming.net/matplotlib-3d-scatterplot-tutorial/
Cheers, MP

Further comment from @GillesDuvert:

As of today, GDL still lacks all "function/object" versions of classical graphical procedures (PLOT, XYOUTS, etc) . Enabling them is a simple task, but a time-consuming one: rewrinting 12+ APIs. There are a few more useful commands to add first (gridding, minimization).

As the current use of the plplot library complicates the task, extremely so for 3D graphics, writing instead thos functions as python code called from GDL using the GDL-python bridge is probably an excellent solution (somebody interested?).

At the time, it is possible to fulfill part of the need using old graphic procedures, avoiding some GDL 3D bugs:

GDL> t = FINDGEN(4001) / 100
GDL> x = COS(t) * (1 + t / 10)
GDL> y = SIN(t) * (1 + t / 10)
GDL> z = SIN(2 * t)
GDL> scale3,xrange=[-6, 6], YRANGE=[-6, 6],ZRANGE=[-1.4, 1.4]
GDL> device,decomp=0
GDL> loadct,13
GDL> plot,x,y,XRANGE=[-6, 6], YRANGE=[-6, 6],/nodata,/t3D
GDL> plots,x,y,z,psym=3,/T3D,color=bytscl(t),THICK=4
GDL> plots,x,y,psym=3,/T3D                
GillesDuvert commented 2 years ago

Now that with #1338 GDL has complete support of 3D, making the PLOT_3DBOX procedure (the procedure equivalent of the function PLOT3D() --- which is another story) should be VERY straightforward.