Wolfram mathematica 在mathematica errorbar图中高亮显示拟合区域

Wolfram mathematica 在mathematica errorbar图中高亮显示拟合区域,wolfram-mathematica,Wolfram Mathematica,我想突出显示mathematica图中的拟合区域,该图上有适当的拟合误差条。要使用错误条绘制某些数据,我编写了以下示例: data={{{0, 0.00126517235028}, ErrorBar[0.0097546177348]}, {{1, 0.0132870239578}, ErrorBar[0.00717311242327]}, {{2, 0.00968907928987}, ErrorBar[0.0125454440978]}, {{3, 0.00835906062

我想突出显示mathematica图中的拟合区域,该图上有适当的拟合误差条。要使用错误条绘制某些数据,我编写了以下示例:

data={{{0, 0.00126517235028}, 
  ErrorBar[0.0097546177348]}, {{1, 0.0132870239578}, 
  ErrorBar[0.00717311242327]}, {{2, 0.00968907928987}, 
  ErrorBar[0.0125454440978]}, {{3, 0.00835906062474}, 
  ErrorBar[0.0196027916911]}, {{4, 0.0141038637039}, 
  ErrorBar[0.0288324766544]}, {{5, 0.0467626302256}, 
  ErrorBar[0.0423090450838]}, {{6, 0.0832535249208}, 
  ErrorBar[0.0609066442506]}};
ErrorListPlot[p0all67, Frame -> True, 
 PlotRange -> {{0, 6}, {0.3, -0.04}}, Axes -> False, 
 PlotStyle -> {AbsolutePointSize[10], AbsoluteThickness[2]}]
现在我使用线性拟合方法在另一个软件中拟合数据,例如,x=4到x=6的拟合结果(或斜率)为0.0317349,误差条为0.0215005。我想用这个拟合值和误差突出显示拟合区域。因此,我希望图表如下所示:

有人能帮我怎么做吗?谢谢

Needs["ErrorBarPlots`"];

data = {{{0, 0.00126517235028}, 
    ErrorBar[0.0097546177348]}, {{1, 0.0132870239578}, 
    ErrorBar[0.00717311242327]}, {{2, 0.00968907928987}, 
    ErrorBar[0.0125454440978]}, {{3, 0.00835906062474}, 
    ErrorBar[0.0196027916911]}, {{4, 0.0141038637039}, 
    ErrorBar[0.0288324766544]}, {{5, 0.0467626302256}, 
    ErrorBar[0.0423090450838]}, {{6, 0.0832535249208}, 
    ErrorBar[0.0609066442506]}};

elp = ErrorListPlot[data, Frame -> True, 
   PlotRange -> {{0, 6}, {-0.05, 0.18}}, Axes -> False, 
   PlotStyle -> {AbsolutePointSize[7], AbsoluteThickness[1]}, 
   PlotRangePadding -> {0.4, 0}];

m = 0.0317349;
line[x_, c_] := m x + c;
{x4, y4} = data[[5, 1]];
ytest = line[x4, 0];
c = y4 - ytest;
check = line[x4, c];
x6 = 6;
y6 = line[x6, c];
delta = 0.0215005;
a = {{x4, y4 + delta}, {x6, y6 + delta}};
b = {{x4, y4 - delta}, {x6, y6 - delta}};

Show[elp,
 ListLinePlot[{{x4, y4}, {x6, y6}}, PlotStyle -> Thick], 
 ListLinePlot[{a, b}, Filling -> {1 -> {2}}, PlotStyle -> None],
 ImageSize -> 500]

这里还有一个基于您的数据的示例,演示了一些统计函数

data = {0.00126517235028, 0.0132870239578, 0.00968907928987,
   0.00835906062474, 0.0141038637039, 0.0467626302256, 0.0832535249208};

lm = LinearModelFit[data, {1, x , x^2, x^3}, x];

{sd1, sd2} = 2*(CDF[NormalDistribution[0, 1], #] - 0.5) & /@ {1, 2};

intervals = Flatten[Transpose /@ Table[
     lm["SinglePredictionConfidenceIntervals", ConfidenceLevel -> cl],
     {cl, {sd1, sd2}}], 1];

{bands68[x_], bands95[x_]} = Table[
   lm["SinglePredictionBands", ConfidenceLevel -> cl], {cl, {sd1, sd2}}];

Show[ListPlot[data, PlotMarkers -> Automatic], ListPlot[intervals],
 Plot[{lm[x], bands68[x], bands95[x]}, {x, 5, 8}, Filling -> {2 -> {1}, 3 -> {2}}],
 PlotRange -> {{1, 7}, {-0.02, 0.1}}, ImageSize -> 480, Frame -> True, Axes -> False]

谢谢。这很有帮助