How could I enable rotation with mouse using PyPlot in Julia


I want to use something in Julia similar to rotate3d in Matlab so I can rotate the figures I produce. My base code looks like this:

function plotPatch()
    fig = figure()
    ax = Axes3D(fig) 
    ax[:set_xlim3d](left=-0.6, right=0.6) 
    ax[:set_ylim3d](bottom=-0.6, top=0.6)
    ax[:set_zlim3d](bottom=-0.6, top=0.6)      

I've googled this and I found: ```ax[:mouse_init]() ```  but nothing happens when I include that in the code.. (no error messages but I'm still not able to rotate the plot). Could I solve it in another way? I'd like to use PyPlot for this therefore I'm especially thankful for tips on how to solve this using PyPlot if that is possible.


It works for me without adding any additional code or clicking any buttons. The only non-default PyPlot option I have is interactive plotting.


It works without the ax[:mouse_init]() line as well.


Okay, how do you chose ion() as non-default PyPlot option in Julia?


Put whatever code you want to run when Julia starts in your .juliarc.jl file. I like to put in packages and paths that I use every day in there as well. Look about halfway down that page I linked to to find reference to .juliarc.jl.


Try with Plots.jl and the plotlyjs backend. The output looks fantastic and is very interactive.


Thank you for your help. I’ve created the .juliarc.jl file but I still don’t understand how I should include ion()? Maybe my question is just how to use ion(). I googled it and found the python code:

plt.plot([1.6, 2.7])``` 
but I still don't understand how to transform this to Julia code?


Put this in your .juliarc.jl file along with whatever else you want.

using PyPlot


Thank you! It works now!


Thank you for your tip!