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

Incorrect labels for scale with large sequences #182

Open
YannDussert opened this issue Apr 23, 2024 · 1 comment
Open

Incorrect labels for scale with large sequences #182

YannDussert opened this issue Apr 23, 2024 · 1 comment
Labels
improvement Improve API/behavior/implementation of an existing feature

Comments

@YannDussert
Copy link

Hi,

Thanks for developing gggenomes!

I came across a small bug when trying to plot "large" sequences with the package, where the labels on the bottom scale were wrong (eg., 2M instead of 1.5M or 2.5M). Here is a small example:

s0 <- tibble::tibble( seq_id = c("a", "b", "c"), length = c(1000000, 1500000, 2500000) )

gggenomes(seqs = s0) + geom_seq()

image

The labels are correct with sequences lengths of 100k/150k/250k or 10M/15M/25M, so I don't really know where the issue could come from.

Best regards,
Yann

@thackl
Copy link
Owner

thackl commented May 22, 2024

Ah, interesting catch. Agreed, not ideal. Internally, I use gggenomes::label_bp which is derived from scales::label_bytes. It uses a fixed accuracy, which by default is set to 1. That means that there will be no digits for any value.

A kind of a workaround is to set accuracy=0.1, but then all labels have digits...

s0 <- tibble::tibble( seq_id = c("a", "b", "c"), length = c(1000000, 1500000, 2500000) )
gggenomes(seqs = s0) +
 geom_seq() +
 scale_x_bp(accuracy=0.1)

image

Need to ponder some more for a good solution

@thackl thackl added the improvement Improve API/behavior/implementation of an existing feature label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve API/behavior/implementation of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants