I voted to close this as a duplicate but since the OP said "it seems too complicated for what I needed to do" here is a way to do it.
Copy the whole code given by Jenswhole code given by Jens and modify the function legendMaker
by commenting Line[...]
in f
:
If[#1 === {None} || (PlotStyle /. {opts}) === None, {}, Line[{{-.1,0}, {.1,0}}]]
should be:
If[#1 === {None} || (PlotStyle /. {opts}) === None, {}, (* Line[{{-.1,0}, {.1,0}} *)]]
You can simply remove the whole line but commenting it allows you to use it afterwards.
Then simply use:
function[gh_, ga_] := If[gh == ga, 1 + 0.18^((gh + ga)^0.25), 1 + 0.18^((gh - ga)^2)^0.25];
p = DiscretePlot[{function[0, i]^i, function[0 + 1, i]^i, function[0 + 2, i]^i}, {i, 0, 30},
PlotRange -> Full];
opts = Sequence[Background -> Transparent, RoundingRadius -> 10];
Overlay[{p,
legendMaker[{"1", "2", "3"},
PlotStyle -> (ColorData[1][#] & /@ Range@3),
PlotMarkers -> {\[FilledSmallCircle]}, opts]},
Alignment -> {Right, Top}]