thackl / gggenomes

A grammar of graphics for comparative genomics
https://thackl.github.io/gggenomes/
Other
572 stars 64 forks source link

how to remove link borders? #169

Closed algrgr closed 7 months ago

algrgr commented 9 months ago

Hello all,

@thackl thanks for this library! I have an "easy" issue which I can't seem to resolve. I think this issue was posted earlier by someone, but there was no solution found yet. I'm trying to make a genome-wide alignment, something like this:

image

As you notice, grey borders of the links heavily obscure the view. Is there a way to remove links borders? (I tried color=NA, etc, without success). One workaround I guess could be assigning color to a variable identical to fill. But this way, added thickness of the border would widen the links, making alignments longer than they actually are (borders do not carry information, do they?). Perhaps I'm missing something obvious here altogether..

cheers, alex

thackl commented 9 months ago

For me, color=NA works. If it doesn't for you, can you share your code?

library(gggenomes)
library(patchwork) # combine plots in one figure
q0 <- gggenomes(emale_genes, emale_seqs) |>
  add_clusters(emale_cogs) +
  geom_seq() + geom_gene()

# link gene clusters with polygon
q1 <- q0 + geom_link(aes(fill=cluster_id))
q2 <- q0 + geom_link(aes(fill=cluster_id), color=NA)

q1 + q2

image

algrgr commented 9 months ago

Ah, I see the problem now! I was using color inside aes. When I moved it outside like in your code, it worked. Thanks for quick reply!