griffithlab / GenVisR

Genome data visualizations
Creative Commons Zero v1.0 Universal
206 stars 62 forks source link

Removal of Legend from TMB plot via theme causes plot to fail #368

Open RiversPharmD opened 4 years ago

RiversPharmD commented 4 years ago

When I pass a pre-counted TMB list to the waterfall plot function, it still assigns three colors in the legend, assigning synonymous, non-synonymous, and unidentified, while the entire graph is colored as unidentified.

When I use the mutBurdenLayer argument with an assigned theme of legend.position = "none", it returns an error:

Error in heatmap_grob[["grobs"]][[ind_legend]] : attempt to select less than one element in get1index

and fails to render the rest of the plot.

Likewise, when I pass this code to the mainLayer, it also fails. Any thoughts?

zlskidmore commented 4 years ago

appologies for the late response,

with the original waterfall() plot, the number of items in the graphical objects must be the same for alignment purposes. I rebuilt the function to in part remedy this but it's not yet ready for use.

If you're looking for a quick solution, you can remove the entire legend after the plot is created

an example:

library(grid)
tmp <- waterfall(brcaMAF, mutBurden = mutation_rate, mainRecurCutoff = 0.25, out="grob")
tmp$grobs[[3]] <- grid.rect(gp=gpar(col="white"))
grid.draw(tmp)
RiversPharmD commented 4 years ago

Phenomenal. I'll try it tonight, and I look forward to your updated code! We've been using it a fair bit for some visualizations, and being able to suppress legends will be great for posters. Zachary Rivers, PharmD

Oncology Pharmacist, Masonic Cancer Center, Fairview Pharmacy Services

PhD Candidate in Social and Administrative Pharmacy (SAPh) College of Pharmacy, University of Minnesota at Twin Cities 7-168 Weaver-Densford Hall, 308 Harvard St. SE, Minneapolis, MN 55455

E-mail: river317@umn.edu Cell: (802) 383-8073

On Mon, Oct 28, 2019 at 12:27 PM Zachary Skidmore notifications@github.com wrote:

appologies for the late response,

with the original waterfall() plot, the number of items in the graphical objects must be the same for alignment purposes. I rebuilt the function to in part remedy this but it's not yet ready for use.

If you're looking for a quick solution, you can remove the entire legend after the plot is created

an example: library(grid) tmp <- waterfall(brcaMAF, mutBurden = mutation_rate, mainRecurCutoff = 0.25, out="grob") tmp$grobs[[3]] <- grid.rect(gp=gpar(col="white")) grid.draw(tmp)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/griffithlab/GenVisR/issues/368?email_source=notifications&email_token=AJRWM655USVSO4V54GTPEW3QQ4OJHA5CNFSM4JDX4PFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECNXEEY#issuecomment-547058195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJRWM67CXNIZ5POSRCYD64LQQ4OJHANCNFSM4JDX4PFA .