Advanced Octave A40 — Annotations and regions of interest

by Giux GX-TXT, octave-en, scripts-en 2 min read

Advanced GNU Octave with GX-TXT · Module 07

A reference line and a highlighted band help to read a chart without altering the measurements. The annotations must make the comparison clearer, leaving the values outside the chosen range visible.

Objectives and prerequisites

We use the Synthetic Dataset octave_advanced_batch_a created in A14 and the bases of the PlotSpec introduced in A37. The example is run with GX-TXT dev112-P011-bis and GNU Octave 9.4.0. Import riferimenti.m, register it and run it in the Runner.

A line and a region

The list panel.annotations contains two structures. The first, reference_line on the x axis, identifies 1 s. The second, reference_region on the left axis, highlights the range between 1.1 and 1.3 V with 0.12 opacity. These values are expressed in the coordinates of the axes displayed. References belong to the panel and do not constitute additional data series.

The script validates the spec, creates a variant and sets units and axes limits. In the execution the validation returned 1. Open the result from Plots tab:

The dotted line crosses the point to 1 s and the grey band includes the values from 1.1 to 1.3 V. In the figure the references are recognized by the positions on the axes: the explanation of their meanings is provided in the text. The curve and the points remain visible even outside the band. This band is chosen for example and does not represent a scientific or regulatory threshold.

Two types of annotation

The reference annotations of the PlotSpec use coordinates of the displayed axles. The framework also has a separate graphic annotation level, described by PLOT_ANNOTATION_API_v1, which uses standardized coordinates of the figure: the two systems have different purposes and coordinates. A scientific reference to a specific value must clearly preserve the unity and meaning of the threshold.

Exercise

  1. What is the vertical line?
  2. Is the point 2 s in the highlighted band?
  3. What changes in the Source Dataset when we add these references?

Worked solution

  1. The time reference of 1 s, chosen for the example.
  2. No: the value is 1.4 V, higher than 1.3 V.
  3. Nothing: line and band are presentation settings, not modifications of the measures.

Download the Module 07 scripts (ZIP)

#GNU Octave #GX-TXT #GX-TXT public APIs

Other steps of this project

Leave a Reply

Your email address will not be published. Required fields are marked *