You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be something about the use of enums to model categorical traits that tries to access the Main scope, and thus fails if the code is included in a module. This code from the plotting functionality works in the repl
using Phylo, Plots
default(linecolor =:black, size = (400, 400)) # looks nicer with black lines
hummers =open(parsenewick, Phylo.path("hummingbirds.tree"))
plot(hummers, size = (400, 600), showtips =false)
using Random
@enum TemperatureTrait lowTempPref midTempPref highTempPref
tempsampler =SymmetricDiscreteTrait(hummers, TemperatureTrait, 0.4)
rand!(tempsampler, hummers)
plot(hummers, showtips =false,
marker_group ="TemperatureTrait",
legend =:topleft, msc =:white, treetype =:fan,
c = [:red:blue:green], ms =10
)
but fails if the same code is included in a module. This means that this example does not work in our docs (where it is taken from).
The text was updated successfully, but these errors were encountered:
So, the trait acquires the name of the enum, which acquires the name of the module. Trying this at the console inside a Test module, the trait is therefore called Main.Test.TemperatureTrait...
@mkborregaard - I've made a temporary(?) fix - https://docs.ecojulia.org/Phylo.jl/dev/man/plotting/ - there's an optional final argument to set the name of the trait, and I've made it "Temperature", and then used that name again in the plot with marker_group="Temperature". If it's likely that people will be creating @enums inside modules, then it may make sense to do some regex work on the name?
Yeah I guess people will not be doing this very often inside modules so it may not matter.
Anyway, I like the syntax with explicitly naming the trait much better actually.
There seems to be something about the use of enums to model categorical traits that tries to access the Main scope, and thus fails if the code is included in a module. This code from the plotting functionality works in the repl
but fails if the same code is included in a module. This means that this example does not work in our docs (where it is taken from).
The text was updated successfully, but these errors were encountered: