# Adding an inset box on a graph

Question:

I would like to have a second inset box on the graph below, as a legend for the graph but it's not showing. I tried to do make it work by editting an old example I had from another question, but it's still just printing the graph (correctly) but without the inset box (which should go underneath the box that can be seen)

Code:

    dataHist5 = {{15, 74}, {33, 64}, {51, 62}, {69, 54}, {87, 47}, {105,
39}, {123, 40}, {141, 35}, {159, 34}, {177, 29}, {195, 34}, {213,
30}, {231, 31}, {249, 22}, {267, 14}, {285, 14}, {303, 13}, {321,
25}, {339, 18}, {357, 11}, {375, 13}, {393, 16}, {411, 13}, {429,
12}, {447, 10}, {465, 12}, {483, 11}, {501, 13}, {519, 9}, {537,
8}, {555, 7}, {573, 5}, {591, 5}, {609, 4}, {627, 5}, {645,
2}, {663, 1}, {681, 3}, {699, 2}, {717, 2}, {735, 1}, {753,
1}, {771, 1}, {789, 0}, {807, 0}, {825, 1}, {843, 2}, {861,
0}, {879, 1}, {897, 1}};
(*Raw counts in fixed interval. No dead time on first point - +3s to \
all the x variables to include it again*)

glm = GeneralizedLinearModelFit[dataHist5, t, t,
ExponentialFamily -> "Poisson"]

ln2 = Log[E, 2]
halfLife = Abs[(ln2/glm["ParameterTableEntries"][[2, 1]])]
sehalfLife =
Abs[(((glm["ParameterTableEntries"][[2, 2]])/(glm[
"ParameterTableEntries"][[2, 1]])))*halfLife*ln2]
(*sigmaT=Abs[t]*ln(2)*(sigmaK/K)*)
k = glm["ParameterTableEntries"][[2, 1]]
\[Sigma]k = glm["ParameterTableEntries"][[2, 2]]
edp = glm["DevianceTableEntries"][[2, 4]]
redp = (glm["DevianceTableEntries"][[2, 4]])/(glm[
"DevianceTableEntries"][[2, 3]])
A = E^(glm["ParameterTableEntries"][[1, 1]])
\[Sigma]A = (
A*(glm["ParameterTableEntries"][[1,
2]]))(*sigmaA=A*sigma(e^a). Where a is Y = e^(a)*e(-kt), and \
e^(a)=A*)

Show[Plot[glm[t], {t, 0, 900}, PlotRange -> All,
PlotTheme -> "Detailed", PlotStyle -> Red, Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {"Time /s",
"Counts Recorded in the Previous 15 seconds"},
ImageSize -> Large],
Plot[A*Exp[-0.00462480948*x], {x, 0, 900}, PlotRange -> All,
PlotTheme -> "Detailed", PlotStyle -> Blue, Axes -> False,
ImageSize -> Large], ListPlot[dataHist5],
Graphics[{Inset[
Framed[Column[{Style["Run 0", Bold],
Row[{"Data Points = ", Length[dataHist5], "/50"}],
Row[{Subscript[t, Style["1/2", FontSize -> 10]], " = ",
PlusMinus[NumberForm[halfLife, 4],
NumberForm[sehalfLife, 3]]}],
Row[{"A = " PlusMinus[Round[A], Round[\[Sigma]A]]}],
Row[{"\[Lambda] = " PlusMinus[NumberForm[k, 3],
NumberForm[\[Sigma]k, 2]]}],
Row[{"D = ", NumberForm[edp, 4]}],
Row[{"Reduced D = ", NumberForm[redp, 3]}]}],
Background -> White, RoundingRadius -> 5], {Right, Top},
Scaled[{1.1, 1.2}]],
Inset[Framed[
Row[{LineLegend[{Red}, {Style[
Background -> White, RoundingRadius -> 5], {Right, 0.1},
Scaled[{1.1, 1.2}]]}],
PlotLabel ->
Style["Decay Curve of Phosphorus-30 by \[Beta]+ Emission", Bold]]


Result: Thoughts:

I think the problem might be to do with where my brackets are, but I can't see where or what bracket might be wrong or missing.

• When posting, please reduce the example to the minimum required to demonstrate the issue and include all data and code required for the minimal example to execute. May 7, 2021 at 16:47

Changed some brackets inside the second Inset:

Show[Plot[glm[t], {t, 0, 900}, PlotRange -> All,
PlotTheme -> "Detailed", PlotStyle -> Red, Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {"Time /s",
"Counts Recorded in the Previous 15 seconds"},
ImageSize -> Large],
Plot[A*Exp[-0.00462480948*x], {x, 0, 900}, PlotRange -> All,
PlotTheme -> "Detailed", PlotStyle -> Blue, Axes -> False,
ImageSize -> Large], ListPlot[dataHist5],
Graphics[{Inset[
Framed[Column[{Style["Run 0", Bold],
Row[{"Data Points = ", Length[dataHist5], "/50"}],
Row[{Subscript[t, Style["1/2", FontSize -> 10]], " = ",
PlusMinus[NumberForm[halfLife, 4],
NumberForm[sehalfLife, 3]]}],
Row[{"A = " PlusMinus[Round[A], Round[\[Sigma]A]]}],
Row[{"\[Lambda] = " PlusMinus[NumberForm[k, 3],
NumberForm[\[Sigma]k, 2]]}],
Row[{Superscript[D, 2], "= ", NumberForm[edp, 4]}],
Row[{"Reduced " Superscript[D, 2], "= ",
NumberForm[redp, 3]}]}], Background -> White,
RoundingRadius -> 5], {Right, Top}, Scaled[{1.1, 1.2}]],
Inset[Framed[Column[{ 