plotSetWhichYAxis

Purpose

Assigns curves to the right or left y-axis.

Format

plotSetWhichYAxis(&myPlot, which)
Parameters:
  • &myPlot (struct pointer) – A plotControl structure pointer.

  • which (string or Nx1 string array) – where each element contains either "right" or "left".

Examples

// Create data
x = seqa(0.1, 0.1, 50);

// Data with y-range of -1 to 1
y1 = sin(x);

// Data with y-range of 0 to 150
y2 = exp(x);

// Declare plotControl structure
struct plotControl myPlot;

// Initialize plotControl structure
myPlot = plotGetDefaults("xy");

// Set the first curve, 'y1' to the left y-axis
// Set the second curve 'y2' to the right y-axis
string which = { "left", "right" };
plotSetWhichYAxis(&myPlot, which);

// Plot the data
plotXY(myPlot, x, y1~y2);

Remarks

Note

This function sets an attribute in a plotControl structure. It does not affect an existing graph, or a new graph drawn using the default settings that are accessible from the Tools > Preferences > Graphics menu.