Advanced Octave A38 — Multiple axes and scale transformations

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

Advanced GNU Octave with GX-TXT · Module 07

A graph can show different sizes on two vertical axes, but this choice requires special attention: heights and visual intersections depend on scales and do not imply equality between sizes with different units.

Objectives and prerequisites

After the PlotSpec of A37 and the graphics of the introductory course, we build a didactic example with a synthetic signal on the left axis and the time spent in seconds on the right axis. The latter series coincides intentionally with the time coordinate: it is used to show how to read two scales, it is not a second sensor. The test uses GX-TXT dev112-P011-bis and Octave 9.4.0.

They serve the Dataset octave_advanced_batch_a of the A14 lesson and a new synthetic Dataset created by the script. The octave_advanced_elapsed_v2 ID is created-only: to repeat the example, use a new Session or change the ID at each point of the code.

Configure the two axes

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

The signal series uses axis = 'left', while the time series uses axis = 'right'. The script validates the spec and uses set_panel_axis to associate names, units and limits to y_left and y_right. The X coordinates of the two Datasets have compatible units and time roles: the maker verifies these relationships when the series share the X axis.

Open the variant generated by Plots tab in the Viewer:

The blue line reads on the left axis in volts; the red on the right one in seconds. The lines intersect visually, but at that point they represent sizes with different units: the intersection also depends on the chosen limits and does not mean that a tension is equal to a time.

Scale and correct comparison

It always indicates to which axis each series belongs and shows units and limits. If the objective is to compare trends, it also evaluates separate graphs or a reasoned normalization: two independent axes can make the gradients look similar or different simply by changing the scales. For a logarithmic scale it is also necessary to verify that domain and values are compatible and to explain to the reader the transformation.

Exercise

  1. What axis do you read the signal line?
  2. Does the crossroads indicate that volts and seconds are equal?
  3. Why should roles and units of X coordinates be verified?

Worked solution

  1. To the left vertical axis, in volt.
  2. No. The two series use different scales and units; the intersection is a property of representation.
  3. To avoid associating on the same coordinate axis that represent incompatible quantities or references.

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 *