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

Allow split.adjust = list(scales = "free") to work as intended #115

Merged
merged 3 commits into from
Aug 3, 2022

Conversation

dtm2451
Copy link
Owner

@dtm2451 dtm2451 commented Aug 2, 2022

PR utilizes knowledge that I did not have when originally writing code for most min / max inputs -- that you can give limits = c(<some_min>, NA) or c(NA, <some_max>) to have ggplot fill in the NA side, at plot time, based on the min/max of the plot's/facet's data--both to simplify these code chunks & to allow better control of faceting by letting split.adjust work as intended, re: #114

For example, split.adjust = list(scales = "free") could now be used in dittoPlot() to let facets zoom in on their own data:

library(dittoSeq)
example(importDittoBulk, echo = FALSE)
# without 'split.adjust'
dittoPlot(object = myRNA, var = dittoSeq:::.extract_Reduced_Dim("tsne", 1, myRNA)$embeddings, group.by = "timepoint",
    split.by = c("clustering"))

image

# with 'split.adjust'
dittoPlot(object = myRNA, var = dittoSeq:::.extract_Reduced_Dim("tsne", 1, myRNA)$embeddings, group.by = "timepoint",
    split.by = c("clustering"),
    split.adjust = list(scales = "free"))

image

ToDo:

  • Test a bit more extensively.
  • Check for stale documentation

@dtm2451
Copy link
Owner Author

dtm2451 commented Aug 3, 2022

Before I merge, just want to note the other functions which benefit from this PR giving them better compatibility with faceting controls like split.adjust = list(scales = "free"):

  • dittoPlot() + derivatives (dittoBoxPlot(), dittoRidgePlot(), dittoRidgeJitter(), multi_dittoPlot())
  • dittoFreqPlot() <-- probably where this update becomes most useful, specifically for lower frequency cell types
  • dittoPlotVarsAcrossGroups()

Other functions where min/max code was updated, but targets the color scale, so has no direct effect on split.adjust = list(scales = "free") and the like:

  • dittoScatterPlot()
  • dittoDimPlot()
  • dittoDotPlot()

@dtm2451 dtm2451 merged commit 4d199ad into master Aug 3, 2022
@dtm2451 dtm2451 deleted the min-max-reduce-impact branch August 3, 2022 21:08
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.

1 participant