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

bulk_clones plot "CNV state" legend colors #182

Open
igordot opened this issue Apr 9, 2024 · 5 comments
Open

bulk_clones plot "CNV state" legend colors #182

igordot opened this issue Apr 9, 2024 · 5 comments

Comments

@igordot
Copy link
Contributor

igordot commented Apr 9, 2024

It seems that the bulk_clones plot is sometimes missing the CNV state colors legend. Is that expected or a bug?

For example, here is the plot from the mouse tutorial with a proper legend:
image

Compare that to the Interpreting Numbat results vignette where the legend only has two colors:
image

@teng-gao
Copy link
Collaborator

Upgrading from ggplot2 3.4.x -> 3.5.0 caused this .. I raised an issue on their github repo. hopefully they fix it soon.

@igordot
Copy link
Contributor Author

igordot commented Apr 10, 2024

Thanks for the update! I had some other packages break with ggplot2 3.5.0 as well.

@teunbrand
Copy link

Hi, I just stumbled across this by accident.
This is intended, and ggplot2 is not going to remedy this issue.
If you want to include all keys of a layer regardless of whether that value is present in the data, you should use show.legend = TRUE.
By default, only keys are shown for which values exist in the data.

@igordot
Copy link
Contributor Author

igordot commented Jun 5, 2024

Curiously, I've seen some packages add specific workarounds related to ggplot2 3.5, so it's definitely a widespread issue without a simple elegant fix. For example, hrbrthemes (with over 1k GitHub stars): https://github.com/hrbrmstr/hrbrthemes/blob/6417996c2931b3fa84102b5034a42a920c91fdb9/R/color.r#L20-L23

@teunbrand
Copy link

The code you linked to is to silence soft-deprecation warnings, which is unrelated to legend keys. The way to restore old behaviour is to use show.legend argument in layers, which is simple enough.

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

No branches or pull requests

3 participants