# About plotting several curves with different vertical scales (more than 2)

I look for the plotting of several curves with different vertical scales. The context is to draw in one plot the 4 curves (jerk, acceleration, velocity and displacement) of a finite jerk motion profile.

This topic has already discussed in the following post : Two vertical axes in the same plot Plot with multiple Y-axes

The second one seems to be good but it is difficult to understand and consequently to modify to adapt to my case.

Consequently, i made this small code :

ScaledPlot[fcts_, coef_, dom_, options___] :=
Plot[Evaluate[coef*fcts], dom,
Evaluate[PlotLegends ->
Row[{##}] &, {coef, {"\[Times]\[ThinSpace]j[t]",
"\[Times]\[ThinSpace]a[t]", "\[Times]\[ThinSpace]v[t]",
"\[Times]\[ThinSpace]q[t]"}}]], options]

ScaledPlot[{j[t], a[t], v[t], q[t]}, {1/40000, 1/200, 1/10, 1}, {t, 0,
1}, Filling -> Axis]


It is almost good but i have some discontinuities for the acceleration :

and i think these discontinuities come from display issues. Indeed, i have no issue when i plot the acceleration curve alone (see below):

1) Have you some ideas to correct the discontinuities that i obtain in the display when i try to plot the 4 curves in the same plot with my method ?

2) Is there somebody interested to make the code present in this post (Plot with multiple Y-axes) more accessible so that it can be used easily ? i would like to use this code but i'm not able to do it for the moment

The code which enables me to obtain these motion profile curves was given in this post :

Finite Jerk Motion Profile

• Providing your functions j[t], a[t], v[t], q[t] might increase the chance to get helpful answers! Commented Nov 17, 2022 at 7:32
• the code is quite big. The code is given here (in a former post) as i said at the end of the post : mathematica.stackexchange.com/questions/275943/… Commented Nov 17, 2022 at 7:57

You can use the MultiaxisArrangement option of ListLinePlot:

ListLinePlot[
Cases[
Plot[{j[t], a[t], v[t], q[t]}, {t, 0, 1}, PlotRange -> All, Exclusions -> None],
Line@pts_ :> pts,
All
],
MultiaxisArrangement -> All
]


Unfortunately, the option is not yet directly supported for Plot, so I extract the lines from the Plot command and replot using ListLinePlot. Also the option is still quite buggy, e.g. adding Filling->Axis leads to the same fill color for all curves:

Finally, note the added Exclusions->None in the plot command, this is to work around an issue in Mathematica 13.1.

• @ interesting, and how can i do if i want than the max of acceleration be above the max of velocity so as to have better visibility Commented Nov 17, 2022 at 9:08
• @Bendesarts Unfortunately I don't think that is supported yet Commented Nov 17, 2022 at 9:18
• Consequently the best will be to simplify the code which is accessible here : mathematica.stackexchange.com/questions/164846/… to make it accessible Commented Nov 17, 2022 at 9:33

With the following option in the plot function : PlotPoints -> 1000 it works !