bioptim icon indicating copy to clipboard operation
bioptim copied to clipboard

Add a twinx axis to show scaling on optimization variables

Open EveCharbie opened this issue 3 years ago • 3 comments

EveCharbie avatar Nov 17 '22 20:11 EveCharbie

Add this axis for scaled variables on plots.

Example:


def celsius_to_fahrenheit(x):
    return x * 1.8 + 32


def fahrenheit_to_celsius(x):
    return (x - 32) / 1.8


secax_y = ax.secondary_yaxis(
    'right', functions=(celsius_to_fahrenheit, fahrenheit_to_celsius))
secax_y.set_ylabel(r'$T\ [^oF]$')

Ipuch avatar Nov 17 '22 20:11 Ipuch

following #572

Ipuch avatar Nov 29 '22 23:11 Ipuch

The bounds on the plots are not scaled either. So there is a mismatch between the variables (scaled) and bounds (unscaled).

EveCharbie avatar Mar 11 '24 14:03 EveCharbie