Closed spsanderson closed 1 month ago
I'm looking for a nice way to specify color that could be either inside of the aes() if it is something like walk_number or outside of the aes() if it is something like "grey" but only have a single function argument like .color = NULL
You might consider still using the list format, but moving colour into geom_line
and exposing it in the .geom
list argument. You could choose for the default to be either a mapping or direct argument using either:
.geom = list(geom_line(mapping = aes(walk_number), alpha = 0.2))
OR.geom = list(geom_line(color = "grey", alpha = 0.2))
and explain the other option in the function documentation.
This is clearer than a .color
option as it places the option in the specific context of geom_line()
, and won't lead to inconsistent effects on additional geoms. Mappings of the form ggplot(aes(color = walk_number))
would be passed on by default to something like + geom_point()
but direct specification are never passed on -- if both color mapping and direct specification are collapsed into a single argument like .color
this will be hidden and difficult to debug for users.
@cynthiahqy This is a new line of thinking for me. I have an idea of basic plots that could be made for each function, I'll have to sketch out how I see them working to see if it makes sense.
I'm going to be working on a discussion for this. I think there should be a function like rw_autoplot()
that will plot out the function output with a minimum of parameters needed to be passed, as in build out the plots with arguments that are necessary like .y
or cum_sum
something like that but the rest being optional.
I am working on this in the discussion here: https://github.com/spsanderson/RandomWalker/discussions/36
@spsanderson, I think the visualize_walks() function is close to what you had in mind, but I do like what @cynthiahqy wrote about the colors and will want to explore that line in the next versions of the function.
Example: