I have two objects displayed in two scenes within Makie. A box with axes appears up for each object. How do I turn these off? I include an image that shows the two sets of axes.
I realize that I could create a single scene, but I wish to manipulate the radius of each sphere via two textsliders
, which requires each sphere to be in its own scene. In other words, I would like to better understand how to create subscenes
with axis visibility turned off. Thank you.
Here is the code (I took out the slider bars since is a MWE):
using Makie
using AbstractPlotting # Not sure this is required
function makePlot_MWE()
parent = Scene()
s_sphere = Scene(parent)
sphere = Sphere(Point3f0(0), .2f0)
mesh!(s_sphere, sphere, color=:red) #, model=model)
s_sphere1 = Scene(parent)
sphere = Sphere(Point3f0(0.2, .3, .1), .5f0)
mesh!(s_sphere1, sphere, color=:green)
return parent
end
makePlot_MWE()
2 Likes
Each scene gets an Axis by default.
Try: show_axis=false
1 Like
It worked! Thank you.
function makePlot_works()
marker_size = 0.0002
sradius, s_marker_radius = textslider((0.5f0:0.25f0:10f0), "Radius", start=2.f0)
sradius1, s_marker_radius1 = textslider((0.5f0:0.25f0:10f0), "Radius", start=2.f0)
par = Scene(show_axis=true)
s_sphere = Scene(par, show_axis=false)
sphere = Sphere(Point3f0(0), .2f0)
meshplot = mesh!(s_sphere, sphere, color=:red)
on(s_marker_radius) do x
scale!(meshplot, x, x, x)
end
s_sphere1 = Scene(par, show_axis=false)
sphere1 = Sphere(Point3f0(0.2, .3, .1), .5f0)
meshplot1 = mesh!(s_sphere1, sphere1, color=:green)
on(s_marker_radius1) do x
scale!(meshplot1, x, x, x)
end
parent = hbox(sradius, sradius1, par) #, parent=parenkjt_scene)
setupCamera!(par);
return parent
end
makePlot_works()
1 Like
@sdanisch: I looked at the source code, and found the Scene
struct
and constructor with no mention of show_axis
within scenes.jl
. Except for a brief mention in the documentation, how would I deduce from the source code that show_axis
was a valid argument to Scene
? Isn’t this argument a popular one if subscenes
are used? I did find scene_attributes which contains :show_axis
and other parameters, such as :limits
. Does that mean that I can use the limits
argument when invoking Scene
? Things are getting a little clearer. Thanks.
function Scene(
events::Events,
px_area::Node{IRect2D},
clear::Bool,
camera::Camera,
camera_controls::RefValue,
scene_limits,
transformation::Transformation,
plots::Vector{AbstractPlot},
theme::Attributes, # the default values a scene owns
attributes::Attributes, # the actual attribute values of a scene
children::Vector{Scene},
current_screens::Vector{AbstractScreen},
parent = nothing,
)
1 Like
Its a big mess that needs cleaning up
The scene struct should get a little overhaul soon!
2 Likes
Overall, Makie is very cool!
2 Likes
@sdanisch:
Why would the following construct crash?
AP.scatter!(parent_scene, x[1:1], y[1:1], z[1:1], markersize=.03, color=:darkblue, transparency=true)
on(marker_radius) do x
AP.scatter!(parent_scene, x[1:1], y[1:1], z[1:1], markersize=x[], color=:darkblue, transparency=true)
I do a scatter of a single point. This works, with markersize=0.03
.
I then add a statement to provide control via a slider. Notice the markersize=x[]
. Why would the code now crash given that x[]
is the underlying value of the Observable? What am I missing?
I now understand how to translate, scale, rotate, individual scene components, each considered as subscenes. I still would like the ability of modify details of a scene as I was trying to do above with AP.scatter(...
, when simple matrix operations on the entire scene are not adequate. Can you help with this?
Must I add and remove subscene components to the parent scene as opposed to updating them? For example, if I wish to modify the location of one of the markers via a text slider, how could I do this?
Thanks.