Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I hide the legend title? #422

Closed
zdlspace0528 opened this issue Aug 8, 2022 · 2 comments
Closed

How can I hide the legend title? #422

zdlspace0528 opened this issue Aug 8, 2022 · 2 comments

Comments

@zdlspace0528
Copy link

Dear all,

When I use AlgebraOfGraphics.jl, How can I hide the legend title? Here is an example.

using RDatasets, AlgebraOfGraphics, CairoMakie
df = dataset("datasets", "iris")
plt = data(df) * mapping(:Species, :SepalLength, color = :Species) * visual(Violin)
fg = draw(plt; legend = (position = :bottom, titlevisible = false, framevisible = false))
截屏2022-08-08 22 46 58
How can I hide the legend title “Species”? I try to use titlevisible = false, but it does not work.

@greimel
Copy link
Collaborator

greimel commented Aug 8, 2022

Try color = :Species => "" and then probably legend = (; titleposition = :left) in draw.

@jkrumbiegel
Copy link
Member

With 0.7 onwards you can also set a label in the scales

df = DataFrame(
    SepalLength = randn(300) .* repeat([1, 2, 3], inner = 100),
    Species = repeat(["Setosa", "Versicolor", "Virginica"], inner = 100),
)

plt = data(df) * mapping(:Species, :SepalLength, color = :Species) * visual(Violin)
fg = draw(plt, scales(Color = (; label = "")); legend = (position = :bottom, titlevisible = false, framevisible = false))
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants