We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there! Is there any way like geom_text_repel for overlapping labels? Here is the plot where I have overlapping labels:
And this is the code:
gggenome + geom_seq(size=1) + # draw contig/chromosome lines geom_bin_label(size = 4) + # label each sequence geom_gene(aes(fill=gene), size=3) + # draw genes as arrow geom_gene_tag(aes(label=gene), nudge_y=0.2, check_overlap = FALSE, hjust = 0.1) + theme(axis.text.x = element_text(size=12), legend.position = "none")
The text was updated successfully, but these errors were encountered:
I haven't directly implemented that in gggenomes, but you can use ggrepel to do it:
library(gggenomes) s0 <- tibble( seq_id = "A", length = 5000 ) g0 <- tibble( seq_id = "A", start=c(1000, 1500, 1550), end=start+50, gene=c("fooo", "baaar", "baaaz") ) gggenomes(g0, s0) + geom_seq() + geom_gene() + geom_gene_tag(aes(label=gene))
library(ggrepel) gggenomes(g0, s0) + geom_seq() + geom_gene() + geom_text(aes(x=(x+xend)/2, y=y+.1, label=gene, color="overlapping"), data=genes(), hjust=0, vjust=0, angle=45) + geom_text_repel(aes(x=(x+xend)/2, y=y+.2, label=gene, color="repelled"), data=genes(), hjust=0, vjust=0, angle=45, direction = "x")
Check out https://ggrepel.slowkow.com/articles/examples.html#align-labels-on-the-top-or-bottom-edge-1 for additional ideas to draw lines between genes and tags, etc...
Sorry, something went wrong.
Thank you so much! Really helpful!
No branches or pull requests
Hi there! Is there any way like geom_text_repel for overlapping labels?
Here is the plot where I have overlapping labels:
And this is the code:
The text was updated successfully, but these errors were encountered: