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

network plot to map the color range to the range of correlations in data #159

Merged
merged 3 commits into from
May 15, 2022

Conversation

thisisdaryn
Copy link
Collaborator

This PR is in response to #158.

network_plot() has been modified so that the legend argument now takes 3 possible values:

  1. "full": the range of colors is mapped to -1 to 1 (this is
  2. "range": the range of colors is mapped to only the range of correlations found in the input rdf
  3. "none" the range of colors is mapped to -1 to 1 without a legend being displayed. This is equivalent to setting legend to FALSE in the previous implementation.

Example of using legend = "full":

mtcars |> select(cyl, disp, hp, wt, carb) |> correlate() |> network_plot(legend = "full")

option_full

Example of using legend = "range":

mtcars |> select(cyl, disp, hp, wt, carb) |> correlate() |> network_plot(legend = "range")
option_range

Example of using legend = "none":

mtcars |> select(cyl, disp, hp, wt, carb) |> correlate() |> network_plot(legend = "none")

option_none

Not specifying any of the options will default to using the full range with a displayed legend.
default

thisisdaryn and others added 2 commits May 8, 2022 22:53
…range of correlations in the data and not to the full range from -1 to 1
Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🙌

I made a minor change to the documentation for the new options. Want to take a look at rlang::arg_match()?

R/cor_df.R Outdated Show resolved Hide resolved
Co-authored-by: Julia Silge <julia.silge@gmail.com>
@juliasilge juliasilge merged commit 62ff93c into tidymodels:add_range_option May 15, 2022
@juliasilge juliasilge mentioned this pull request May 15, 2022
juliasilge added a commit that referenced this pull request May 15, 2022
…ata (#159) (#160)

* Adding an option for network plot to map the color range only to the range of correlations in the data and not to the full range from -1 to 1

* Adjust documentation for new options

* Update R/cor_df.R

Co-authored-by: Julia Silge <julia.silge@gmail.com>

Co-authored-by: Julia Silge <julia.silge@gmail.com>

Co-authored-by: Daryn Ramsden <thisisdaryn@gmail.com>
@juliasilge
Copy link
Member

Ooops @thisisdaryn it seems like something went a little wonky with git here. It looks like the PR was to the add_range_option branch instead of to main. I didn't notice this until after I merged the PR, so I did another PR #160 to merge into main. No big deal but in the future, you might want to make sure you are setting up a PR to the main branch.

juliasilge added a commit that referenced this pull request May 15, 2022
@thisisdaryn
Copy link
Collaborator Author

Ooops @thisisdaryn it seems like something went a little wonky with git here. It looks like the PR was to the add_range_option branch instead of to main. I didn't notice this until after I merged the PR, so I did another PR #160 to merge into main. No big deal but in the future, you might want to make sure you are setting up a PR to the main branch.

Noted. My bad. Will look out for that in the future. Thanks.

@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants