I have an analytical 1d-function of a variable called $M$ and I have plotted that function using the following code:
yfunc[M_] := 10^(12 - M);
sigma[M_] := (16.9*(yfunc[M])^0.41)/(1 + 1.102*(yfunc[M])^0.20 + 6.22*(yfunc[M])^0.333);
dsigmadM[M_] := (Log[10]*10^M)^-1*D[sigma[x], x] //. x -> M;
xfunc[M_] := 1.686/sigma[M];
func[M_] := 0.322*Sqrt[(2*0.707)/\[Pi]]*(1 + (0.707*(xfunc[M])^2)^-0.3)* xfunc[M]*Exp[-((0.707*(xfunc[M])^2)/2)];
h[M_] := -0.05152*10^12*func[M]/sigma[M]*dsigmadM[M];
f[M_] := 0.54*(M - 12) + 2.73;
g[M_?NumericQ] := 1301.98*(0.7)^2*10^-6*NIntegrate[(10^f[x])*h[x]*Log[10], {x, M, \[Infinity]}];
LogPlot[g[M], {M, 8, 16}, PlotRange -> {10^-17, 10},
Frame -> True,
FrameLabel -> {Style["Log(M)", FontSize -> 24], Style["Y-axis Log scale", FontSize -> 24]},
FrameTicksStyle -> Directive[FontSize -> 24]]
I also have a set of 32 discrete points $(M, u[M])$ corresponding to some other function whose analytical form is unknown but it is fair enough to join the data points in a dot-to-dot manner. I was able to do so using the following code:
a = 25;
MyData = {{8.90 + Log10[a], 0.0003256}, {9.0 + Log10[a],
0.0002971}, {9.10 + Log10[a], 0.0002980}, {9.20 + Log10[a],
0.0002757}, {9.30 + Log10[a], 0.0002546}, {9.40 + Log10[a],
0.0002400}, {9.50 + Log10[a], 0.0002253}, {9.60 + Log10[a],
0.0002015}, {9.70 + Log10[a], 0.0001900}, {9.80 + Log10[a],
0.0001856}, {9.90 + Log10[a], 0.0001750}, {10.0 + Log10[a],
0.0001753}, {10.10 + Log10[a], 0.0001732}, {10.20 + Log10[a],
0.0001692}, {10.30 + Log10[a], 0.0001630}, {10.40 + Log10[a],
0.0001503}, {10.50 + Log10[a], 0.0001309}, {10.60 + Log10[a],
0.0001135}, {10.70 + Log10[a], 0.00009117}, {10.80 + Log10[a],
0.00007193}, {10.90 + Log10[a], 0.00005419}, {11.00 + Log10[a],
0.00003707}, {11.10 + Log10[a], 0.00002439}, {11.20 + Log10[a],
0.00001501}, {11.30 + Log10[a], 0.000008719}, {11.40 + Log10[a],
0.000004783}, {11.50 + Log10[a], 0.000002529}, {11.60 + Log10[a],
0.000001170}, {11.70 + Log10[a], 0.0000004598}, {11.80 + Log10[a],
0.0000001803}, {11.90 + Log10[a],
0.00000006044}, {12.00 + Log10[a], 0.00000001651}};
error = {0.0000146, 0.0000119, 0.0000112, 0.00000903, 0.00000774,
0.00000672, 0.00000578, 0.00000469, 0.00000443, 0.00000389,
0.00000325, 0.00000326, 0.00000281, 0.00000235, 0.00000227,
0.00000174, 0.00000152, 0.00000131, 0.00000106, 0.000000833,
0.000000627, 0.000000429, 0.000000339, 0.000000244, 0.000000162,
0.000000100, 0.0000000709, 0.0000000411, 0.0000000239,
0.0000000142, 0.00000000769, 0.00000000390};
withError = Transpose[{MyData[[All, 1]], MyData[[All, 2]], error}];
errorplot = ErrorListPlot[withError, Joined -> True, Frame -> True];
lerrorplot = errorplot /. {x_Real, y_Real} -> {x, Log@y};
Show[ListLogPlot[MyData, PlotRange -> {10^-17, 10},
PlotStyle -> {Red, Thick}, Joined -> True, Frame -> True,
FrameLabel -> {Style["Log(M)", FontSize -> 24], Style["Y-axis Log scale", FontSize -> 24]},
FrameTicksStyle -> Directive[FontSize -> 24]], lerrorplot]
Now, I am trying to merge two plots into one by adding my second set of data points into my first plot. My first question is how to do it? and my second question is assuming $a$ is the Interval[50 + 25 {-1, 1}] rather than a fixed value of $a=25,$ how to plot the confidence region of the best fit (or joined data) on the single plot produced by merging the two?
Your help is appreciated,
{f[M], g[M], h[M], p[M], q[M]}definitions. Instead of ugly oldPlotLegends\``, check out option for mostPlots calledPlotLegends`. – Johu Jun 09 '16 at 07:16Showdoes work for overlaying two different graphics. Your problem might be, thatErrorListPlotandLogPlothave different coordinates -Log[y]vsy. So you need to implement logarithmicErrorListPlotyourself. Check out Plotting Error Bars on a Log Scale. – Johu Jun 09 '16 at 07:27Showis exactly ment for that. – Johu Jun 12 '16 at 19:58Showwill work, if the first parameter is a list of plots, which you want to have overlaid. You have provided two parameters. You should also addNeeds["ErrorBarPlots"]` into the beginning of your code. – Johu Jun 12 '16 at 21:26