matiasandina / ggethos

https://matiasandina.github.io/ggethos/
Other
1 stars 1 forks source link

Forcefully color NAs when `aes(color=NULL)` or `aes(...), ..., color="salmon")` is provided and `remove_nas=F` #10

Open matiasandina opened 2 years ago

matiasandina commented 2 years ago

I believe that something like this:

ggplot(wombats, aes(x=frame, behaviour=behaviour, y=wombat)) + geom_ethogram(remove_nas = F)

Should return this

image

But the NAs should be forcefully colored in gray. Maybe this is one of the things that could be handled by setup_data #8 ?

matiasandina commented 1 year ago

I think we can do this here

https://github.com/matiasandina/ggethos/blob/2fd669c63afb056003e24623bf26a5e9781fda12/R/ggethos.R#L108-L110

Something like

if (remove_nas) {
  ...
}
else{
data <- mutate(data, colour=ifelse(is.na(colour), "gray50", colour))
}