I have a two time differential equations system: A[t]
and B[t]
. (I am omitting their specific form.) I would like to display the evolution of the two variables over time in a one plot with two y-axes with a label on each axis and a legend below the x-axis After days of research I found that Overlay
could be one solution. So my code is the following:
p1 = Plot[A[t] /. sol, {t, 1, 10}, PlotStyle -> {Black}, BaseStyle -> {FontSize -> 14},
Ticks -> {{}, {94, 96, 98, 100}}, ImagePadding -> 25, FrameTicks -> {None, All, None, None},
Frame -> {True, True, False, False}]
p2 = Plot[B[t] /. sol, {t, 1, 10}, PlotStyle -> {Black, Dashed}, BaseStyle -> {FontSize -> 14},
Ticks -> {{}, {2, 4, 6, 8, 10}}, FrameTicks -> {None, None, None, All}, ImagePadding -> 25,
Frame -> {False, False, False, True}]
p = Overlay[{p1, p2}]
Export["p.pdf", %]
This produces
However, after another days of research I failed to figure out how to include label for each axis, A
for left y-axis, B
for right y-axis, and t
for x-axis, and a legend (for the two curves) below x-axis. I tried various combinations and various versions of PlotLabel
, FrameLabel
, PlotLegend
, etc. without success. Can anyone help?