how to pass set of attributes to command
How to pass a set of attributes to a command by having all attributes predefined in an array (?), string (?), whatever (?) ?
A general solution is preferred to learn about, but maybe there are only package specific solutions?
For example, some graphical plotting code using GLMakie.jl could simplified be written like this:
using GLMakie
# ... much code goes here ...
scatter(x1, y2, color = :red, markersize = 8)
# ... much code goes here ...
scatter!(x2, y2, color = :green, markersize = 2)
# ... much code goes here ...
scatter!(x3, y3, color = :red, markersize = 8)
Changing my decision on the attributes “color” and “markersize” requires to find all positions in my code where the attributes in question have been used and individually change them there. But it would be more convenient for me to maintain my code in a way allowing me to easily find close to the top of the code definitions of sets of attributes, which can then be reused later in the code. For example, I would like to structure my code like shown in the following, and please note that I did not find which syntax to use for it and the correct syntax which has to be used in the following code is actually what my question is about:
using GLMakie
# ... very few code goes here ...
myAttributes_A = [ "color = :red", "markersize = 8" ]
myAttributes_B = [ "color = :green", "markersize = 2" ]
# ... much code goes here ...
scatter(x1, y2, myAttributes_A)
# ... much code goes here ...
scatter!(x2, y2, myAttributes_B)
# ... much code goes here ...
scatter!(x3, y3, myAttributes_A)
Besides searching for a solution for the commands from the GLMakie package, I assume that in Julia something like this will follow a general recommended syntax, right? Or does this always depends on the specific command implementation?