-
Notifications
You must be signed in to change notification settings - Fork 123
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
How can I completely remove the legend? #61
Comments
The legend has been a problem for many users, so I propose adding an argument to disable - maybe something like While it is possible currently to remove, it is difficult and hacky. |
Thanks, that's highly appreciated! It's boggling my mind where in the code the label 'Legend' with the checkbox is actually created. I simply don't see it the sunburst.js file. But to have the option to remove it that would be great. The main reason I want to remove it is that it becomes too lengthy and therefore impractical. |
@Geoffrey-Guest, the reason for the confusion is the custom html on the R side in lines. In general, I favor the more general |
@Geoffrey-Guest, would you mind trying I opted to keep the custom |
@timelyportfolio thanks for doing this. I tested it out and it looks to work quite well. One small thing is when the sunburst renders you can see the Legend label with checkbox but it disappears as soon as the figure is finished rendering, so not a big deal. I'm not sure what you mean by "piggybacking on what was the legend config argument is confusing." Another issue I'm facing involves the overlap of the breadcrump with the figure. It was especially apparent in a knitr html Rmd test run (see attached). Unfortunately I cannot attach html files. For a reason I don't know, the sunburst doesn't render in the html knitr file if I specify the width/height in sunburst(...). Anyways I played around with the "// Dimensions of sunburst" in "sunburst.js" to get dimensions that suited me best. thanks again. |
@Geoffrey-Guest, thanks for testing... legend breadcrumb calculation error |
No I didn't pre-sum it. Each value represents the contribution of its respective pathway. You can use the csv I uploaded... sequences = read.csv("sequences.csv",header = TRUE) sb <- sequences %>% sb |
@Geoffrey-Guest, is the aggregation not a sum? Also I could not get the data to work in sunburst, so I could not test (sorry). Let's take something like. With your data what would be
Here is what I tried.
|
If you aggregate the value column yes that would be the total. The size in your df should be the same parameter as my value in sequences. The sum of all values is the total. The code worked for me with the Cran version I had downloaded. I adapted my data to conform to one of your examples. I tried both your coding attempts and they both worked with the Cran version but not your github version. It looks like the issue in terms of it not rendering is the width and height arguments. For example, these all worked with your github version (though erroneous breakdown):
I'm not sure what changed. How should I organize my data now? |
@Geoffrey-Guest, thanks for the additional information. I most definitely don't want data to break with changes, so I'd like to use your example data as a test case to determine why the change does not work with your data. I'll spend some time over the weekend working through the problem. If possible, could you provide session info for the working version? It sounds like current CRAN works, so this is not critical if it is too much hassle. |
Okay thanks for looking into it. Here's the session info: other attached packages: loaded via a namespace (and not attached): |
I installed CRAN version, and the example is not working. In console I see, ... so I went back farther to ... so then I thought since small numbers, try |
@Geoffrey-Guest, back to the original issue on whether before or after is correct, I used
|
thanks for investigating @timelyportfolio . I don't think the after is correct. As an example take the contributing pathway "Other Pathways...." (last row in dataset and largest contributor in the after) and calculate the % contribution and it is equal to 10.2% (0.26259/2.574) which is equivalent to the 'BEFORE' whereas the 'AFTER' = 52.7%. So perhaps our definitions of what value should be are different or you changed the definition in your latest version. For me each value is the contribution that the pathway is responsible for and sum(value) is the total contribution across all pathways. Perhaps your latest release ignores the really small values...? |
@Geoffrey-Guest, I figured it out. In your data, children do not sum to parent, and I don't think imposing this constraint would be good, so I have started #62. Getting closer to a solution I think... |
@Geoffrey-Guest, if possible, will you please test with |
@Geoffrey-Guest, in addition, you might want to try the new
|
oh wow amazing you got that new version up and running! THanks for all your efforts in making it work for me! |
Both are working but with a few limitations/issues: for sund2b(): the absolute values are being rounded to the nearest value with 0 decimal places so the report values aren't useful for me right now. It would be good to always keep absolute and % values with 3 significant digits. Also, for the main contributing pathway, for some reason two extra layers are being tacked on but they shouldn't be there (i.e. diesel burned in building machine). Also, it would be nicer if the breadcrumbs were wider so I would be able to see a long trail more easily on the screen. ONe other thing I was thinking about... I like sunburst() because it has functionality to do something on-click and I set it up in a shiny app and when a user clicks a segment, greater details are presented in a table/figure. WIll this click-segment functionality be lost with the sund2b visual because a click results in a zoomable or is it possible to have both? Other than that it looks really good, very promising! |
I just checked, and when the legend is absent ( The author Kevin Warne of I plan to add Shiny to d2b, so will let you know when I get that implemented. |
Thanks, sorry you're right, with sunburst() I do get the entire width with no legend. I guess because the viewer window was small at first and then I maximized the window and the width didn't update to the new window size. At this point for my current purposes I tend to like your original sunburst() over the d2b sunburst. I think it's more intuitive and the zooming might get confusing to some users. There was indeed a rendering issue as I mentioned earlier. In the sequences df, you can see the pathway is captured correctly and even the values are right but the ??segment arc length?? is too big (should only be 0.4%) and it's a lot larger. It's row 7 in the df. If you compare the two sunbursts side-by-side it looks like there might be other issues too. Right now I trust the rendered figure from sunburst() more than sund2b() right now. Do you get the same error? |
@Geoffrey-Guest, we lose some control over the sum/aggregate with |
thanks a lot @timelyportfolio |
@Geoffrey-Guest, since your data is in a tree structure, yes Sankey should work, but given the level of depth, it might not render well in constrained space. I'll try to add an example. |
going to close. please feel free to reopen. I'll reference https://github.com/fbreitwieser/hiervis for sankey tree. |
I'm looking for a way to remove the initialization of the legend. I've commented out all code that I thought was to do with the legend (in sunburst.js) and now the Legend toggle doesn't work. However, I don't want to see the Legend label and toggle. Any idea what I'm missing? Thanks a lot.
The text was updated successfully, but these errors were encountered: