# Graphing in Detail

Graphs in the UI are structured representations of data – the structure describing where the data is found, and how it is presented. The graph components are built by the same toolbox / Drag and Drop operations as any other component in the simulation, though graphs are updated when displayed – not after the “run simulation” button is pressed.

The graph toolbox has 3 folders – commonly used graph types; individual components used to make a graph, and collections of complex graphs and associated reports. The graph types are:

- XY (or scatterplot) charts allow the user to plot 2 variables from a set of data on different axes (Scatter plot)
- A Probability of Exceedance chart that displays a single set of data against its cumulative frequency
- A Cumulative Distribution Function (CDF) that uses a more formal definition of cumulative frequency
- A box plot where quantiles and extremes of a data set are shown as overlaid rectangles (Box plot)
- 3 SOI Phase (Phases of the Southern Oscillation Index – described in Nature) charts that categorise a dataset in ENSO like groups,
- A Depth plot that describes a layered dataset over a soil profile,
- A Predicted – Observed chart that adds regression statistics to an XY plot,
- A R graphics chart that uses the R statistical computing language to desribe a graph.

Each of these graph types is a composite of “graph bits” – normal usage is to take one of the graph types, drop it onto your simulation, and customise the “bits” to present the data as you wish. By default, the graph uses whatever data it finds in its position in the simulation tree: if it’s dropped on an outputfile component, it will use data from that outputfile; if it’s in a paddock, it will use all outputfiles within that paddock, and if it’s at the top level *simulations* node it will use all the output files in all the simulations.

You will see that CDF and probability charts are a variation of simple XY charts; with a GDProbability object between the data source (ApsimFileReader) and the plot reader. This object calculates the “probability” column that is used as one axis by the chart.

The three SOI chart variants serve to break a dataset into 5 categories, one for each phase of the SOI: positive, rising, zero, negative and falling. Each category serves to create a set of analogues: years when the SOI in a particular month (chosen by the user) is the same.

Unlike timeseries (eg X(Date) vs Y) plots, depth plots are a way to look at the soil profile at an instant in time – they present depth on the vertical axis, and a data variable on the horizontal. These are used to great effect when displaying water or nutrient contents. Static values (eg LL, DUL) can be plotted as a guide.

The R graphics component simply calls R to run a script that leaves behind an image file that is displayed on the first tab. The second tab is where the user enters the script. The third tab displays any error messages from R as it runs the script.