Graphplot in a loop

I would like to use graphplot in a loop inside a function. But graphplot does not return a value. How can this be done? Here is a MWE that demonstrates that I am not getting a plot.

using Plots, GraphRecipes, LightGraphs

function myPlot()
    g1 = SimpleGraph(10,20)
    g2 = SimpleGraph(10,20)
    graphplot(g1, x=rand(10), y=rand(10))
    graphplot(g2, x=rand(10), y=rand(10))
end

myPlot()

I would like to see the teo plots superimposed. I notice that graphplot! exists, but using that instead of graphplot did not help.If I return current() from the function, I get one of the graphplots. How do I superimpose them? One way is to create a single graph by merging. I would rather not.

You just need to assign the graphplot to a variable that you then return from your function:

function myPlot()
    g1 = SimpleGraph(10,20)
    g2 = SimpleGraph(10,20)
    p = graphplot(g1, x=rand(10), y=rand(10))
    graphplot!(p, g2, x=rand(10), y=rand(10), nodecolor = "red")

    p
end

This worked, thank you! I simply returned current() from the function instead of p. But I guess that display(p) outside the function would also work and allow me to control when the graph was plotted. I will mark the problem solved.