0
$\begingroup$

I have these two plots that I want to merge in order to create a plot with two axes. I just want to translate the second plot in order for them precisely coincide. However, it seems that the Translate command does not work for plots. How can I make the plots coincide?

Thanks!

lambda=18.0;

dataIL={{0*lambda,-7.919},{10*lambda,-8.274},{50*lambda,-9.381},{100*lambda,-11.193},{200*lambda,-14.969}};

fitIL=Transpose[{Table[x,{x,0,200*lambda,lambda}],Table[-7.810743628185908`-0.001957142262202232` x,{x,0,200*lambda,lambda}]}];

dataGD={{0*lambda,0.03849},{10*lambda,0.05877},{50*lambda,0.1597},{100*lambda,0.2843},{200*lambda,0.5677}};

fitGD=Transpose[{Table[x,{x,0,200*lambda,lambda}],Table[0.03100392803598201` +0.00014721301849075468` x,{x,0,200*lambda,lambda}]}];

a=ListPlot[{dataIL,fitIL},PlotRange->{All,All},Joined->{False,True},PlotStyle->{{Thickness[0.0060],PointSize[0.007],Darker[Opacity[1,Blue],0.5]},{Thickness[0.0060],PointSize[0.007],Darker[Opacity[1,Red],0.15]}},PlotLegends->Placed[LineLegend[{Style["Experimental",Black,40,FontFamily->"Arial"],Style["Fitted",Black,40,FontFamily->"Arial"]},LegendLabel->None,LegendFunction->Framed,LegendMargins->{{5,5},{1,1}},LegendMarkerSize->{35,5}],{Right,Top}],Frame->True,FrameStyle->Directive[Thickness[0.0015]],FrameTicks->{{{-15,-14,-13,-12,-11,-10,-9,-8},None},{{0,1000,2000,3000,4000},None}},FrameLabel->{Style["Transmitter-Receiver Gap, lDL (μm)",Black,48,FontFamily->"Arial"],Style["Transmission, Mag(S21) (dB)",Black,48,FontFamily->"Arial"]},LabelStyle->{Black,48,FontFamily->"Arial"},ImagePadding->{{150,10},{130,50}},ImageMargins->{{10,10},{10,10}},Axes->False,ImageSize->1000]

b=ListPlot[{dataGD,fitGD},PlotRange->{All,All},Joined->{False,True},PlotStyle->{{Thickness[0.0060],PointSize[0.007],Darker[Opacity[1,Blue],0.5]},{Thickness[0.0060],PointSize[0.007],Darker[Opacity[1,Red],0.15]}},PlotLegends->Placed[LineLegend[{Style["Experimental",Black,40,FontFamily->"Arial"],Style["Fitted",Black,40,FontFamily->"Arial"]},LegendLabel->None,LegendFunction->Framed,LegendMargins->{{5,5},{1,1}},LegendMarkerSize->{35,5}],{Right,Bottom}],Frame->True,FrameStyle->Directive[Thickness[0.0015]],FrameTicks->{{None,{0,0.25,0.5,0.75,1}},{{0,1000,2000,3000,4000},None}},FrameLabel->{{None,Style["Group Delay, τ21 (μs)",Black,48,FontFamily->"Arial"]},{Style["Transmitter-Receiver Gap, lDL (μm)",Black,48,FontFamily->"Arial"],None}},LabelStyle->{Black,48,FontFamily->"Arial"},ImagePadding->{{10,150},{130,50}},ImageMargins->{{10,10},{10,10}},Axes->False,ImageSize->1000]

Overlay[{a,b}]
$\endgroup$
1
$\begingroup$

A starting point:

lambda=18.0;
dataIL={{0*lambda,-7.919},{10*lambda,-8.274},{50*lambda,-9.381},{100*lambda,-11.193},{200*lambda,-14.969}};
fitIL=Transpose[{Table[x,{x,0,200*lambda,lambda}],Table[-7.810743628185908`-0.001957142262202232` x,{x,0,200*lambda,lambda}]}];
dataGD={{0*lambda,0.03849},{10*lambda,0.05877},{50*lambda,0.1597},{100*lambda,0.2843},{200*lambda,0.5677}};
fitGD=Transpose[{Table[x,{x,0,200*lambda,lambda}],Table[0.03100392803598201` +0.00014721301849075468` x,{x,0,200*lambda,lambda}]}];
a=ListPlot[{dataIL,fitIL},PlotRange->All,Frame->{{True,False},{True,True}},FrameTicks -> {{All, None}, {All,None}},ImagePadding ->20];
b=ListPlot[{dataGD,fitGD},PlotRange->All,Frame->{{False,True},{False,False}},FrameTicks -> {{None, All}, {None, None}},ImagePadding ->20];
Overlay[{a,b}]

Output:

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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