The plot! command tries to plot onto whatever the most recent figure was, which is (as you’ve discovered) not a particularly reliable way to do things. Instead, you can use the returned value from one plot to reliably add to the same plot later:
julia> plt1 = plot([1, 2, 3])
julia> plt2 = plot([4, 5, 6])
julia> plot!(plt1, [7, 8, 9])
In this case, only [1, 2, 3] and [7, 8, 9] show up in the same plot because we have explicitly told plot! which figure to use. Perhaps you can hold a single plot outside of the for loop and then plot!() into that plot at each iteration? Something like:
julia> plt = plot()
julia> for i in 1:10
plot!(plt, i .* (1:5))
end
julia> display(plt)