Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

What is the relationship between theme and attributes?

Open wsrinin opened this issue 5 years ago • 6 comments

Hi,

I was wondering what is the relationship between theme and attributes. For example, if I update one of the Attributes in attribute do the attributes in theme get update as well?

Best,

wsrinin avatar Mar 30 '19 21:03 wsrinin

Can you give an example code sample of what you mean?

SimonDanisch avatar Apr 08 '19 08:04 SimonDanisch

@SimonDanisch There is not much to go by from the docs when defining recipes. It only uses either Theme or Attributes, never both.

For example if I want a recipe that uses both a Theme and Attributes I would expect something like this to work

@recipe(MyPlot) do scene
    Theme(
        a = :red
     )
    Attributes(
        b = :blue
    )
end

But it does not. I can not access both myplot.a and myplot.b in the plot! function. This should be somehow specified in the docs. Is there a way how to use both? I can then add it to the docs.

kunzaatko avatar May 15 '22 09:05 kunzaatko

Theme is just a shorthand for Attributes. I think it was introduced because we were planning on moving away from Attributes, but I'm not 100% sure.


julia> Theme
Attributes

julia> Attributes
Attributes

julia> Theme == Attributes
true

To answer your question, the preferred route is to just use Theme.

asinghvi17 avatar May 15 '22 15:05 asinghvi17

OK then. Thank you. I will change Attributes in the documentation to avoid more confusion then and submit a PR. Then this issue can maybe be closed?

kunzaatko avatar May 16 '22 13:05 kunzaatko

I don't know why it included the other commits... Why is this?

kunzaatko avatar May 16 '22 14:05 kunzaatko

this is such a foot gun, have we decided what to use? if so we should remove all Attributes in docs at least, and throw a deprecation in code, I can do it

Moelf avatar Jun 09 '22 03:06 Moelf