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

added node coloring in DependencyReporter (fixes #238, #239) #243

Merged
merged 10 commits into from
Jul 21, 2020
Merged

added node coloring in DependencyReporter (fixes #238, #239) #243

merged 10 commits into from
Jul 21, 2020

Conversation

jameslamb
Copy link
Collaborator

In this PR, I propose one way we could accomplish #238 and #239

@codecov-io
Copy link

codecov-io commented Oct 21, 2019

Codecov Report

Merging #243 into master will decrease coverage by 1.45%.
The diff coverage is 83.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
- Coverage   92.46%   91.01%   -1.46%     
==========================================
  Files          12       12              
  Lines         929      957      +28     
==========================================
+ Hits          859      871      +12     
- Misses         70       86      +16
Impacted Files Coverage Δ
R/DependencyReporter.R 82.88% <100%> (+3.09%) ⬆️
R/AbstractGraphReporter.R 81.28% <73.52%> (-8.72%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fe580d...ead2b68. Read the comment docs.

@jameslamb jameslamb marked this pull request as ready for review October 22, 2019 02:04
@jameslamb
Copy link
Collaborator Author

Alright @jayqi @bburns632 I think this is ready for review!

To test, you can run this code

WHERE_YOUR_REPO_IS <- "~/repos/pkgnet/"
devtools::load_all(WHERE_YOUR_REPO_IS)

pkg_name <- 'ggplot2'
reporter <- DependencyReporter$new()
reporter$set_package(
    pkg_name = pkg_name
)
reporter$graph_viz

CreatePackageReport(
    pkg_name = pkg_name
)

I could not figure out how to generate a legend. Simply adding visNetwork::visLegend() wasn't working for me. So for now I propose settling for just describing the colors in text on the Dependency Report page and then opening an issue to add the legend later. But @bburns632 @jayqi you're both better at visNetwork than me so lmk if you see an easy way to add one in this PR!

@jameslamb
Copy link
Collaborator Author

Hey friends! Could I get a review on this, at your earliest convenience?

@jameslamb
Copy link
Collaborator Author

Hey friends! Could I get a review on this, at your earliest convenience?

👀

@jameslamb
Copy link
Collaborator Author

@bburns632 @jayqi could I get a review on this?

@jameslamb
Copy link
Collaborator Author

@bburns632 @jayqi could I get a review on this?

@bburns632 @jayqi

@bburns632
Copy link
Collaborator

bburns632 commented Jan 7, 2020 via email

@jameslamb
Copy link
Collaborator Author

Ha no problem! I'm having fun finding Agnes GIFs to put on here

Copy link
Collaborator

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

Love this! Also thank you for refactoring all of the node color stuff. It looks a lot more clear.

I'm not totally sold on the colors. I thinking maybe the report package should be more visually distinct, and the base packages are less interesting. Maybe swap their colors so the report package is bright green and the base packages are grey?

It would also be cool if the report package was a different shape, like a square or something, but that may be out of scope. :)

Copy link
Collaborator

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

I'm going to mark this as "Request changes" just to make sure we don't miss the discussion in my above comment. Potentially we may decide not to change anything.

Copy link
Collaborator

@bburns632 bburns632 left a comment

Choose a reason for hiding this comment

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

two things

@bburns632
Copy link
Collaborator

@jameslamb Two things:

  1. I get this error "## Error in setkeyv(resultDT, "node_name"): some columns are not in the data.table: node_name" printed directly in the report. That needs to be fixed.
  2. I second @jayqi 's comment on color choice. As it stands, the mundane "in every R installation" is colored the most vibrantly. IMO that should be in the bleh gray or tope or something. What about something along the lines of target repo = black, regular R packages = light gray, and other packages the light green or something else catchy?

@bburns632
Copy link
Collaborator

I auto-approved then looked at it since I drug this review out so long... 😬

@jameslamb
Copy link
Collaborator Author

@jameslamb Two things:

  1. I get this error "## Error in setkeyv(resultDT, "node_name"): some columns are not in the data.table: node_name" printed directly in the report. That needs to be fixed.
  2. I second @jayqi 's comment on color choice. As it stands, the mundane "in every R installation" is colored the most vibrantly. IMO that should be in the bleh gray or tope or something. What about something along the lines of target repo = black, regular R packages = light gray, and other packages the light green or something else catchy?

sure I can do number 2. What code did you run that produced the error you see in 1?

@jameslamb
Copy link
Collaborator Author

Just updated! Here's what it's looking like for ggplot2

image

@bburns632 I generated this by running the code from #243 (comment), except that I installed the package and library()'d it instead of devtools::load_all(), and I didn't get the error you reported. So maybe just installing the package fixes that error?

@jayqi
Copy link
Collaborator

jayqi commented Jan 27, 2020

Looks great! Wondering if we should add a legend. visNetwork's legends look terrible but maybe still better to have one.

@jameslamb
Copy link
Collaborator Author

Looks great! Wondering if we should add a legend. visNetwork's legends look terrible but maybe still better to have one.

I totally agree with you, but like I said in #243 (comment) I personally don't know how to add legend :/

R/AbstractGraphReporter.R Outdated Show resolved Hide resolved
@bburns632
Copy link
Collaborator

bburns632 commented Jan 31, 2020 via email

@jameslamb
Copy link
Collaborator Author

Is there a vizLegend command? https://datastorm-open.github.io/visNetwork/legend.html

On Fri, Jan 31, 2020, 1:07 AM Jay Qi @.> wrote: @.* commented on this pull request. ------------------------------ In R/AbstractGraphReporter.R <#243 (comment)>: > @@ -291,80 +291,86 @@ AbstractGraphReporter <- R6::R6Class( ## Color Nodes - # Flag for us to do stuff later + # This flag controls whether nodes are colored by categorical + # groups or some continuous attribute colorByGroup <- FALSE (Also sorry about missing your comment regarding the legend before.) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#243?email_source=notifications&email_token=AF3FDS2JQPAR5MEUXHGTM5TRAPE2NA5CNFSM4IZZM7TKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCTYMJMQ#discussion_r373340927>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3FDSY4KFB3K4LQUYZ7MW3RAPE2NANCNFSM4IZZM7TA .

yes there is. As I mentioned in #243 (comment), I wasn't able to get it to work. I should have been more specific than just "couldn't get it working" because now I don't remember.

It sounds like you and @jayqi really really want a legend to be part of this PR...totally fair. Let me check it out this weekend.

@jayqi
Copy link
Collaborator

jayqi commented Jan 31, 2020

Regardless of if we want a legend or not, there is some leftover old code in the plot_network function that you should clean up, because it may lead to (or already is leading to) bugs.

@jameslamb
Copy link
Collaborator Author

Ok think I've addressed the comments in 84753ef. Take a look!

The legend now looks like this:

image

The addNodes part of visLegend is mostly undocumented, so I couldn't figure out how to change the font color on individual things in the legend. I changed the package in focus to orange (from black) because of that.

I chose to stick with ellipses after struggling for a while with circles. It was hard to get the circle text to resize, so I was ending up with circles that were overlapping or different sizes.

@jayqi jayqi requested review from jayqi and bburns632 February 1, 2020 19:56
Copy link
Collaborator

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

DependencyReporter looks great. I'm getting an error in InheritanceReporter running it on pkgnet though.

Screen Shot 2020-02-01 at 11 54 57 AM

## Error in `[.data.table`(plotDTnodes, get(colorFieldName) == groupVal, : j (the 2nd argument inside [...]) is a single symbol but column name 'color' is not found. Perhaps you intended DT[, ..color]. This difference to data.frame is deliberate and explained in FAQ 1.1.

@jameslamb
Copy link
Collaborator Author

blegh yeah I saw that on Travis. Looking!

@jameslamb
Copy link
Collaborator Author

Sorry for the long delay! I think this is working as expected!

Try installing from this branch and running CreatePackageReport, such as:

CreatePackageReport(
    pkg_name = "pkgnet"
    , pkg_reporters = list(
        pkgnet::FunctionReporter$new()
        , pkgnet::DependencyReporter$new()
        , pkgnet::InheritanceReporter$new()
    )
)

#243 (review)

I also just rebased to master to get the latest changes.

@jameslamb jameslamb requested a review from jayqi June 10, 2020 03:43
@jameslamb
Copy link
Collaborator Author

I think this is now working as expected. Could I get another review?

@jameslamb jameslamb requested a review from a team June 27, 2020 20:32
@jameslamb
Copy link
Collaborator Author

I just rebased to master to get the latest changes.

Copy link
Collaborator

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

Just tested it and it looks good.

@bburns632
Copy link
Collaborator

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants