Prev: axis-cut.html Up Next: axis-pos.html
Let an axis show transformed values of another one

Practical Guide:
double g = 10; // gravitational constant

set::xtitle("Time [s]");
set::y1title("Velocity [m/s]");
set::y2title("Length of fall [m]");

// v = g*t, this is plotted on the y1 axis with plot(_1,g*_1)
// the length of fall, s = v*v/2/g, v = sqrt(2*g*s)
// this is the general form:
frame::current().y2axis()->transform(frame::current().y1axis(), _1*_1/2/g, sqrt(2*g*_1));

// The short-hand version:

plot(_1,g*_1).legend("Velocity and distance of falling object");

.... under development

Source files:

Prev: axis-cut.html Up Next: axis-pos.html