Advanced Octave A37 — Complex PlotSpecs and validation

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

Advanced GNU Octave with GX-TXT · Module 07

A persistent scientific chart can connect multiple series to their Datasets, keeping variables, axes and options identifiable. A valid specification is the starting point; the legibility of the result must be controlled in the Viewer.

Objectives and prerequisites

The introductory course has already introduced the GX-TXT charts. Here we build a PlotSpec with two series using PLOT_DATASET_API_v4 from Octave, we validate it and direct the vertical axis. We need the two synthetic datasets created in A14. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.

Building the specification

Import plot_due_serie.m, register it and run it in the Runner.

new_spec prepares a specific XY; the script adds to the panel two structures containing Dataset ID, Variable ID, axis, type of series and label. It assigns them into a cell array at panel.series, then reinsertes the panel into the specification. validate_spec controls the specification before creating the chart.

The program creates a persistent variant, sets labels and axle units, and uses render to get the figure. To prevent the legend from covering the last point of the upper series, the test explicitly sets a vertical range from 0,8 to 2,8 V: a layout choice that must remain declared and readable.

Observe the result

On the Plots tab, select the created variant and open the image in the Viewer. The following figure is a real screenshot of the result, with two synthetic series and visible points.

The A series ranges from 1,0 to 1,4 V; B from 2,0 to 2,4 V, both between 0 and 2 s. The lines link the points of the didactic model and do not represent additional measures. The ID of the variant depends on the Session: do not assume that it is identical to the one displayed in the test.

The validation of the specification checks the contract, but does not decide whether colors, scales and legends are suitable for the public. Check that all points and units are visible and that the axes limits do not induce incorrect interpretations. A new performance of create_plot creates a new variant; it explicitly stores or manages the variants you need.

Exercise

  1. What connects each series to scientific data?
  2. Why have we expanded the vertical range?
  3. Does a valid specification automatically ensure that the graph is readable?

Worked solution

  1. Dataset ID and identification of X and Y variables.
  2. To prevent the legend from covering a point, keeping the scale explicit.
  3. No. Legibility and communicative correctness require a control of the figure.

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 *