I’m working my way through basic Julia exercises in a course. I have no problem with most of it but I haven’t yet grasped the odd way plots seem to work. Here’s a basic fn for calculating the steady state values of a logistic map:
function steady_state_values(r)
    b = 0.25
    for i in 1:400
        b = r * b * (1-b)
    end
    attractor_values = zeros(150)
    for i in 1:150
        b = r * b * (1-b)
        attractor_values[i] = b
    end
    return attractor_values
end
I want to vary the parameter r (along the x axis) and plot the corresponding steady state values along y. I’ve tried variations of this:
using Plots
first = true
for r = 2.9 : 0.001 : 4
    y = steady_state_values(r)
    x = fill(r, length(y))
    if first
        plot(x=x, y=y)
        first = false
    else
        plot!(x=x, y=y)
    end
end
Multiple calls to plot don’t seem to work–they result in no output-- so I plot the first array then call plot! subsequently. Even this doesn’t work. Can someone explain the logic?  I come from matplotlib where you call figure() to begin, then any number of plotting operations, then show().
Plots.jl doesn’t seem to work that way.  I’ve gone through a Plots.jl notebook but it didn’t clarify.
Thanks,
-Tom