Makie.jl: Why isn't centering the scene automatic for first plots?

Created on 4 Feb 2018  Â·  8Comments  Â·  Source: JuliaPlots/Makie.jl

The basic plotting commands all have to center!(scene) afterwards, can this be removed?

Most helpful comment

Yes, it should definitely be optional, but I think the default is a little wrong right now.

scene = Scene(resolution = (500, 500))
scatter(rand(10), rand(10))
center!(scene)

as the most basic plot should really be

scatter(rand(10), rand(10))

like you'd find anywhere else. I think a good default would be to automatically center! the first time a plot is displayed. Otherwise, why display it is it's just going to give a random white image? Then, if you don't want it center!ed, build it up without displaying it or flip the option manually so you can display it and center it later.

All 8 comments

This messes with the easy "scene-free usage":

julia> using Makie

julia> scatter(rand(10), rand(10))
Scene scatter:
Dict{Symbol,Any} with 19 entries:
  :positions   => <Node: GeometryTypes.Point{2,Float32}[Float32[0.590564, 0.246…
  :strokecolor => <Node: RGBA{Float32}(0.0,0.0,0.0,0.0)>
  :visible     => <Node: true>
  :glowwidth   => <Node: 0.0>
  :scale       => <Node: Float32[1.0, 1.0, 1.0]>
  :markersize  => <Node: Float32[0.1, 0.1]>
  :camera      => <Node: :auto>
  :rotations   => <Node: Makie.Billboard()>
  :x           => <Node: [0.590565, 0.833756, 0.12991, 0.249585, 0.86067, 0.456…
  :strokewidth => <Node: 0.0>
  :light       => <Node: GeometryTypes.Vec{3,Float32}[Float32[1.0, 1.0, 1.0], F…
  :rotation    => <Node: Float32[0.0, 0.0, 0.0, 1.0]>
  :model       => <Node: Float32[1.0 0.0 0.0 0.0; 0.0 1.0 0.0 0.0; 0.0 0.0 1.0 …
  :marker      => <Node: GeometryTypes.HyperSphere{2,Float32}(Float32[0.0, 0.0]…
  :offset      => <Node: Float32[0.0, 0.0, 0.0]>
  :color       => <Node: RGBA{Float32}(0.894118,0.101961,0.109804,1.0)>
  :show        => <Node: true>
  :y           => <Node: [0.246589, 0.510987, 0.745296, 0.858083, 0.784647, 0.4…
  :glowcolor   => <Node: RGBA{Float32}(0.0,0.0,0.0,0.0)>

julia> center!() # fails

Computing the bounding box can be quite intensive so it should be optional I believe.

Yes, it should definitely be optional, but I think the default is a little wrong right now.

scene = Scene(resolution = (500, 500))
scatter(rand(10), rand(10))
center!(scene)

as the most basic plot should really be

scatter(rand(10), rand(10))

like you'd find anywhere else. I think a good default would be to automatically center! the first time a plot is displayed. Otherwise, why display it is it's just going to give a random white image? Then, if you don't want it center!ed, build it up without displaying it or flip the option manually so you can display it and center it later.

Yes, of course! This will be part of the default plot recipe!

Is the plan to build a default plot recipe over the current plotting functions? I.e. plot as a default recipe?

Yes, that sounds like what I plan! I still haven't decided if I will change the behavior of e.g. a pure scatter call to do the same as plot, stay plain, or have a new low level scatter that will have the current behavior, and dispatch scatter to e.g. plot(Scatter(), args...; kw_args...)

That sounds like a very sensible way to handle it. plot(Scatter(), args...; kw_args...) would be a type-recipe on Scatter?

Yes, I think you can call it that! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Photonico picture Photonico  Â·  3Comments

DoktorMike picture DoktorMike  Â·  6Comments

EricForgy picture EricForgy  Â·  5Comments

asinghvi17 picture asinghvi17  Â·  5Comments

Datseris picture Datseris  Â·  7Comments