02_user_tutorials:plotting:plotting-data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
02_user_tutorials:plotting:plotting-data [2025/12/10 13:14] – removed - external edit (Unknown date) 127.0.0.102_user_tutorials:plotting:plotting-data [2026/03/20 17:51] (current) Tim
Line 1: Line 1:
 +~~NOTOC~~
 +{{howhard>2}}
 +====== Plots inside GroIMP ======
 +
 +GroIMP has the ability to visualize datasets in different plots. 
 +
 +
 +===== =====
 +To learn more about datasets visit the [[02_user_tutorials:dataset:01_basics
 +|dataset tutorial]].
 +
 +
 +To visualize a dataset in GroIMP the chart() function is used:
 +<code java>
 + chart(diagram, XY_PLOT);
 +</code>
 +
 +in a full example like this:
 +
 +<code java Plot_example.rgg>
 +module A(float len) extends Sphere(0.1)
 +{
 + {setShader(GREEN);}
 +}
 +DatasetRef diagram = new DatasetRef("plot");
 +
 +protected void init ()
 +[
 + Axiom ==> A(1);
 + {
 + diagram.setTitle("My fancy plot");
 +
 + diagram.clear();
 +     diagram.setColumnKey(0,"max(x)").setColumnKey(1,"max(y)").setColumnKey(2,"max(z)");
 + chart(diagram, XY_PLOT);
 +     
 + }
 +]
 +
 +public void run ()
 +
 +[
 + A(x) ==> F(x) [RU(30) RH(90) A(x*0.8)] [RU(-30) RH(90) A(x*0.8)];
 + {
 + diagram.addRow().set(0,max(location((*A*)).x)).set(1,max(location((*A*)).y)).set(2,max(location((*A*)).z));
 +
 + }
 +]
 +
 +</code>