How can I generate a two plots using Plots.jl and GR as the backend within the same window. I am using the following code from one of the book but plots appear in two separate windows. The book uses Pyplot.jl.
using Plots, StatsBase
# Sampling with withReplacement
function proportionFished(gF,sF,numberFished,N,withReplacement = false)
function fishing()
fishInPond = [ones(Int64,gF); zeros(Int64,sF)]
fishCaught = Int64[]
for fish in 1:numberFished
fished = rand(fishInPond)
push!(fishCaught,fished)
if withReplacement == false
deleteat!(fishInPond, findfirst(x->x==fished, fishInPond))
end
end
sum(fishCaught)
end
simulations = [fishing() for _ in 1:N]
proportions = counts(simulations,0:numberFished)/N
if withReplacement
plot!(0:numberFished,proportions,linestyle = :dot, linetype=:sticks, markershape=:hexagon,label="With replacement",legend=:topleft);
else
plot!(0:numberFished,proportions, label="Without replacement",legend=:topleft,linetype=:sticks,linestyle = :dot,color="blue")
end
end
N = 10^5;
goldFish, silverFish, numberFished = 3, 4, 3;
plot()
proportionFished(goldFish, silverFish, numberFished, N)
proportionFished(goldFish, silverFish, numberFished, N, true)