When making subplots, it seems that in order to get full control over the appearance one should do the
update_scenes! sequence. (The so-called “matrix pun” method fails to transfer the
layout structure when making the subplots–I suspect this is a design feature of Plotly and not a Julia problem.)
However, I believe there is a problem when doing so: Most likely the problem is this Julia-Plotly beginner, but also possible is a bug in either the Julia binding or in Plotly itself. Please consider the following short demo which makes two surface plots as elements of a 1 x 2 subplot:
using PlotlyJS x = collect(range(-15, stop=15, length=3)) y = collect(range(-15, stop=15, length=3)) xGrid, yGrid = mgrid(y, x) z_1 = xGrid.^2 + yGrid.^2 z_2 = abs.(sin.(xGrid / 3.0) + sin.(yGrid / 3.0)) surface_1 = surface(;x=x, y=y, z=z_1, showscale = false) surface_2 = surface(;x=x, y=y, z=z_2, showscale = false) fig = make_subplots(rows = 1, cols = 2, specs = [Spec(kind = "scene") Spec(kind = "scene")]) add_trace!(fig, surface_1, row = 1, col = 1) add_trace!(fig, surface_2, row = 1, col = 2) update_scenes!(fig, camera_projection_type = "perspective", camera_eye = attr(x = 1.6, y = 1.6, z = 0.7), aspectmode = "cube", row = 1, col = 1) update_scenes!(fig, camera_projection_type = "orthographic", camera_eye = attr(x = -1.6, y = -1.6, z = 0.7), aspectmode = "data", row = 1, col = 2) display(fig)
When rendered, we see that the scene attributes
aspectmode for the first scene at position
[1, 1], called
scene, have all been ignored, apparently overwritten by the corresponding attributes from the second scene, called
Indeed, one can easily see this error when examining the
layout portion of
fig which is easy when e.g. using the Julia extension for Visual Studio Code. When doing so, we see that the column number for
scene is reported as 2 when it should be 1. Manually setting it to 2 does not help because it returns to 2 when the plot is re-rendered.
P.S. This is a follow-up to this earlier post: Z component of scene_camera_eye not being passed to subplots - #4 by oscar.