02_user_tutorials:plotting:plotting-data
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 02_user_tutorials:plotting:plotting-data [2025/12/10 13:14] – ↷ Page moved from 02_new_tutorials:plotting:plotting-data to 02_user_tutorials:plotting:plotting-data gaetan | 02_user_tutorials:plotting:plotting-data [2026/03/20 17:51] (current) – Tim | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~NOTOC~~ | ||
| {{howhard> | {{howhard> | ||
| - | ====== | + | ====== Plots inside GroIMP ====== |
| + | GroIMP has the ability to visualize datasets in different plots. | ||
| - | GroIMP comes with an included management of dataset and the ability to visualize them, in the following only a small introduction is given. | ||
| - | ===== Datasets in RGG ===== | + | ===== ===== |
| + | To learn more about datasets visit the [[02_user_tutorials: | ||
| + | |dataset tutorial]]. | ||
| - | A datasets in GroIMP are simple tables, that can be referenced from RGG and the GUI. | ||
| - | |||
| - | ==== Getting data in ==== | ||
| - | |||
| - | To create a Dataset in GroIMP the DataSetRef object is used as following: | ||
| - | <code java> | ||
| - | DatasetRef diagram = new DatasetRef(" | ||
| - | </ | ||
| - | |||
| - | In a dataset each row is described as a Dataseries and to add data a new series has to be added as following: | ||
| - | |||
| - | <code java> | ||
| - | Dataseries ds = diagram.addRow(); | ||
| - | </ | ||
| - | |||
| - | Now we can add numeric data to the different columns of this series by using the set function: | ||
| - | <code java> | ||
| - | ds.set(0, | ||
| - | ds.set(1, | ||
| - | for(int i=2; i<10; i++){ | ||
| - | | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | It is also possible to create a new row in a dataset in one line of code: | ||
| - | <code java> | ||
| - | diagram.addRow().set(0, | ||
| - | </ | ||
| - | |||
| - | ==== Clearing ==== | ||
| - | |||
| - | A dataset is a Resource of GroIMP and therefore not removed when the simulation is reset or recompiled. In order to clear a dataset the following command can be used. | ||
| - | <code java> | ||
| - | diagram.clear(); | ||
| - | </ | ||
| - | |||
| - | ==== Column titles ==== | ||
| - | |||
| - | Similar to the set function it is possible to add column titles using the following command: | ||
| - | |||
| - | <code java > | ||
| - | diagram.setColumnKey(0," | ||
| - | </ | ||
| - | |||
| - | |||
| - | ==== Exporting datasets ==== | ||
| - | |||
| - | It is possible to export a dataset from RGG using a Java FileWriter as shown below: | ||
| - | |||
| - | <code java> | ||
| - | import java.io.FileWriter; | ||
| - | public void getData(){ | ||
| - | DatasetRef diagram = new DatasetRef(" | ||
| - | FileWriter fw = new FileWriter("/ | ||
| - | diagram.export(fw); | ||
| - | fw.close(); | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | It is also possible to define the Separator that is used for the file by e.g. '' | ||
| - | And the same works as well with a StringBuffer instead of the FileWriter. | ||
| - | |||
| - | ===== Datasets in Gui ===== | ||
| - | |||
| - | The datasets can be seen in the dataset explorer. This can be found in the main menu under Panels/ | ||
| - | |||
| - | ===== Visualizing Datasets ===== | ||
| To visualize a dataset in GroIMP the chart() function is used: | To visualize a dataset in GroIMP the chart() function is used: | ||
| Line 82: | Line 18: | ||
| in a full example like this: | in a full example like this: | ||
| - | <code java> | + | <code java Plot_example.rgg> |
| module A(float len) extends Sphere(0.1) | module A(float len) extends Sphere(0.1) | ||
| { | { | ||
02_user_tutorials/plotting/plotting-data.1765368852.txt.gz · Last modified: 2025/12/10 13:14 by gaetan
