Created
February 26, 2020 04:39
-
-
Save PetrKryslUCSD/479773bc78dff42830cc829828896d2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using PlotlyJS | |
using JSON | |
plots = scatter3d(;x = rand(6), y = rand(6), z = rand(6)) | |
layout = Layout(width="600", height="600", autosize=true, title="Change the view, then switch to commandline", | |
scene=attr( | |
xaxis=attr(title="X", gridcolor="rgb(255, 255, 255)", | |
zerolinecolor="rgb(255, 255, 255)", | |
showbackground=true, | |
backgroundcolor="rgb(25, 25, 25)"), | |
yaxis=attr(title="Y", gridcolor="rgb(255, 255, 255)", | |
zerolinecolor="rgb(255, 255, 255)", | |
showbackground=true, | |
backgroundcolor="rgb(25, 25, 25)"), | |
zaxis=attr(title="Z", gridcolor="rgb(255, 255, 255)", | |
zerolinecolor="rgb(255, 255, 255)", | |
showbackground=true, | |
backgroundcolor="rgb(25, 25, 25)"), | |
camera = attr(eye = attr(x = 0.98, y = 0.9, z = 0.1), | |
center = attr(x = 0, y = 0, z = 0), | |
up = attr(x = 0, y = 0, z = 1)), | |
aspectmode = "manual"), | |
showlegend=false, | |
) | |
println("Original view parameters") | |
@show layout["scene"][:camera] | |
pl = plot(plots, layout) | |
display(pl) | |
println("Press enter") | |
n = readline() | |
savejson(pl, "plot.json") # This is the plot saved after the view has been manipulated | |
# After manipulation of the view with the mouse retrieve the view parameters | |
d = open("plot.json", "r") do f; | |
JSON.parse(String(read(f))) | |
end | |
println("View parameters after the plot was changed") | |
@show d["layout"]["scene"]["camera"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment