Skip to content

Instantly share code, notes, and snippets.

@jkrumbiegel
Created March 17, 2020 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkrumbiegel/f0691fd86c688e385a520d6a8229cab6 to your computer and use it in GitHub Desktop.
Save jkrumbiegel/f0691fd86c688e385a520d6a8229cab6 to your computer and use it in GitHub Desktop.
faking a legend with multiple sections
using Makie
using MakieLayout
using GLFW; GLFW.WindowHint(GLFW.FLOATING, 1)
##
scene, layout = layoutscene()
ax = layout[1, 1] = LAxis(scene)
scats = [scatter!(ax, rand(10, 2), markersize = i * px) for i in 5:5:20]
lins = [lines!(ax, rand(10, 2), color = c) for c in [:red, :green, :blue, :orange]]
leg1 = LLegend(scene, scats, string.(5:5:20), title = "Sizes", framevisible = false, height = Auto(true), halign = :left)
leg2 = LLegend(scene, lins, string.([:red, :green, :blue, :orange]), title = "Sizes", framevisible = false, height = Auto(true))
subgl = layout[1, 2] = vbox!(leg1, leg2; height = Auto(false))
subgl[1:2, 1] = LRect(scene, color = :transparent, strokewidth = 1)
scene
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment