Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass more than a single item to pluck? #132

Open
spsanderson opened this issue Oct 24, 2024 · 2 comments
Open

Pass more than a single item to pluck? #132

spsanderson opened this issue Oct 24, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@spsanderson
Copy link
Owner

spsanderson commented Oct 24, 2024

I think that it might be good to see if you can pass more than one item to pluck

@spsanderson
Copy link
Owner Author

Here is a tidyverse version, needs work obviously but I think you will get the idea @AnttiRask

library(RandomWalker)
library(dplyr)
library(ggplot2)
library(tidyr)

random_normal_walk(.initial_value = 10000, .num_walks = 25) |>
  select(walk_number, x, y, cum_prod) |>
  pivot_longer(cols=c(y, cum_prod), names_to = "variable", values_to = "value") |>
  mutate(variable = factor(variable, levels = c("y", "cum_prod"))) |>
  ggplot(aes(x=x, group = walk_number, y=value, color=walk_number)) +
  facet_wrap(~variable, scales="free") +
  geom_line(alpha = 1 - 0.328) +
  theme_minimal() +
  theme(legend.position = "none")

image

You will probably want to work it like you did the visualize_walks() function to compose them together and incorporate ggirafe

@spsanderson spsanderson changed the title Side by Side Plot Pass more than a single item to pluck? Oct 24, 2024
@spsanderson
Copy link
Owner Author

@AnttiRask I have updated this function in the development branch to handle the change of x being renamed to step_number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants