PlotlyJS backend (for Plots.jl) not loading plot

Hello, I am plotting the bifurcation diagram for the logistic map f_{\mu}(x)=\mu x (1-x) using the Plots.jl package, and would like to make it interactive with the plotlyjs() backend. However, when I try calling plotlyjs(), it gives me a blank plot. The code works fine when I use the default backend.

My program creates a vector of parameters, and then for every parameter it stores iterated values from an initial point into a matrix, which is then plotted against the parameters vector to create the bifurcation diagram. I figure the problem is my use of matrices, since I can use pyplotjs() in other programs, but I am not sure how to fix that issue. I have put my full code below if anyone would like to try it out. I am using the latest version of Julia.

using Plots
plotlyjs()

global x0=0.1  #initial value between 0 and 1
f(x,μ)=μ*x*(1-x)  #logistic map

firstParam=0.01  #first paramater
lastParam=4  #last paramater
numParams = 2000  #number of parameters to graph
iter=2000  #number of iterations from initial value to get to attracting points
iterKeep=500  #number of iterations to graph

params=range(firstParam, lastParam, length=numParams)  #paramaters

values=zeros(numParams)  #initialize vector that will contain the iterations from initial point
for n in 1:numParams
    x=x0
    μ=params[n]  #nth paramater
    for m in 1:iter
        x=f(x,μ)  #iterate an iter amount of times
    end
    values[n]=x  #store iterated value in "values"
end

orbit=zeros(numParams, iterKeep)  #initialize matrix which will contain attracting points
for n in 1:numParams
    x=values[n]
    orbit[n,1]=x  #set first point to f^[0](x)=x
    μ=params[n]
    for m in 2:iterKeep  #set mth point to be f^[m-1](x)
        x=f(x,μ)
        orbit[n,m]=x  #store value
    end
end

scatter(params, orbit, markersize=0.01, legend=false, color=false, title="Bifurcation Diagram", xlabel="Parameters", ylabel="Attractors")
#plot points, set graphical size of points to 0.01 pixels, remove legend, make the graph color black, and label the graph.

Your example seems to have too many points for the plotlyjs backend to handle. It will eventually plot your example (you need to increase the marker size) after a long wait, but the interaction will also be very slow. If you reduce the iterations and plot with a larger marker size, you will see that it works and faster.

1 Like

You could try the inspectdr() backend, that handles well your example.

Check first the keybindings for smooth interaction with the plot.

1 Like

Thank you, inspectdr() works well. I will still have to reduce the iterates (I probably should have realized this was the problem), but it handles the diagram much better.