3
$\begingroup$

I want to plot two plots on a single frame. First is listplot and second is plot. for example,

 d1 = {{100, 0.1}, {1000, 0.5}, {10000, 0.9}} 
 d2= {{100,0.5},{1000,0.7},{10000,0.89}}
  ListPlot[{d1,d2}]

 Plot[{-  0.01 Sin[0.0005 t + Pi/4],  - 0.01 Sin[
0.002 t  + Pi/4] }, {t, 0, 10000}]

Now the plot and listplot have same xaxis range whereas different yaxis range. I want to make frame's right yaxis for the plot and left yaxis for the listplot. How can I combine these plots on a single frame. I tried overlay but the export image size becomes huge in overlay.

$\endgroup$
2

1 Answer 1

8
$\begingroup$

Using ResourceFunction["CombinePlots"] with its "AxesSides" option:

d1 = {{100, 0.1}, {1000, 0.5}, {10000, 0.9}};
d2 = {{100, 0.5}, {1000, 0.7}, {10000, 0.89}};
ResourceFunction["CombinePlots"][
 ListPlot[{d1, d2}, Frame -> True],
 Plot[{-0.01 Sin[0.0005 t + Pi/4], -0.01 Sin[0.002 t + Pi/4]}, {t, 0, 10000}, Frame -> True],
 "AxesSides" -> "TwoY"
 ]

enter image description here

(Note that I set Frame->True for both plots)

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.