1

plot1 = ListPlot[MNvsAmp, PlotRange -> All, PlotStyle -> PointSize[Large], ImagePadding -> 85, Frame -> {True, True, True, False}, FrameLabel -> {"Time, s", "Number of atoms, 1000"}, PlotMarkers -> {marker1, .035}, PlotLegends -> "gamma = 1.903 beta = 2.173*10^(-20)"];

plot2 = ListPlot[TvsTXTvalue, PlotRange -> All, PlotStyle -> PointSize[Large], ImagePadding -> 85, Frame -> {False, False, False, True}, FrameTicks ->{None, None, None, All}, FrameLabel -> {{"","Temperature, mK"},{"",""}}, PlotMarkers -> {marker2, .035}, PlotLegends -> "gamma = 1.903 beta = 2.173*10^(-20)"];

plot3 = Plot[Normal[bettafit], {tt, 3.7, 4.4}, PlotStyle -> Directive [Thick], Axes -> {False, False}]

Overlay[{plot1, plot2, plot3}]

这是我得到的结果,曲线在不应该出现的地方

在此处输入图像描述

4

1 回答 1

1

改编Jason B 的代码

d1 = {{2, 6.4}, {4, 5.5}, {7, 4.6}, {9, 4.5}};
d2 = {{1.4, 32.4}, {3.4, 25.5}, {6.7, 20.6}, {8.9, 21.5}};
fit = Fit[d1, {1, x, x^2}, x];

TwoAxisListPlot[{list1_, list2_, fit_},
  opts : OptionsPattern[]] :=
 Module[{plot1, plot2, ranges, p1, min, max},
  {plot1, plot2} = ListLinePlot /@ {list1, list2};
  ranges = Last@Charting`get2DPlotRange@# & /@ {plot1, plot2};
  p1 = ListPlot[{list1, Transpose@{First /@ list2,
       Rescale[Last /@ list2, Last@ranges, First@ranges]}},
    Frame -> True, FrameTicks -> {{Automatic,
       Charting`FindTicks[First@ranges, Last@ranges]},
      {Automatic, Automatic}},
    FrameStyle -> {{Automatic, ColorData[97][2]},
      {Automatic, Automatic}}, FilterRules[{opts},
     Options[ListPlot]]];
  {min, max} = First@Charting`get2DPlotRange@p1;
  Show[p1, Plot[fit, {x, min, max}]]]

TwoAxisListPlot[{d1, d2, fit},
 FrameLabel -> {{Row[{"Number of atoms, ",
      Superscript[10, 3]}], "Temperature, \[Mu]K"},
   {"Time, s", ""}}, BaseStyle -> {FontSize -> 14}]

在此处输入图像描述

于 2017-09-02T13:07:40.727 回答