Closed hkaspersen closed 2 years ago
If you don't set a fill
aesthetic, the default fill/color is just a fixed grayish value with some transparency so it is easier to spot overlaps: aes(colour = "honeydew3", fill = "honeydew3", size = 0.5, linetype = 1, alpha = 0.7)
.
gggenomes(seqs=emale_seqs, links=emale_ava) + geom_link()
But you can set fill
, alpha
, etc. to a variable, based on the data in your link table. For example:
# color links by match identity
gggenomes(seqs=emale_seqs, links=emale_ava) +
geom_link(aes(fill=map_match/map_length))
Thank you for a quick reply!
This works for me. However when I combine it with geom_gene
I get the follwing error:
gggenomes(seqs=emale_seqs, links=emale_ava, genes = emale_genes) +
geom_link(aes(fill=map_match/map_length)) +
geom_gene(aes(fill = name))
Error: Discrete value supplied to continuous scale
Any thoughts on this?
Edit:
I did manage to get it to work with ggnewscale
, as it seems to be an issue with a discrete and continuous fill variable:
library(ggnewscale)
gggenomes(seqs=emale_seqs, links=emale_ava, genes = emale_genes) +
geom_link(aes(fill=map_match/map_length)) +
new_scale("fill") +
geom_gene(aes(fill = name))
Ah, yes. Using fill with multiple variables in the same plot is something that by design does not really work with ggplot. But there are workarounds, such as ggnewscale
. The general ggplot idea is that two many different color scales make the plot too hard to understand. I usually try to follow that notion, and try to use color for the feature I want to primarily highlight. I use, for example, color for genes and than grey scales using alpha
for link identity...
Hi!
I have a question regarding the border in geom_link. It seems that it can't change the color of the border when changing the fill color of link. I wonder if it can set the size, color and presence of the border.
Thank you very much!
Hello, and thanks for an awesome tool!
I have a question regarding geom_link. I tried to figure out what it's actually plotting. Is the links' fillcolour based on a variable in the
paf
file? Trying to figure out which values are used here. I couldn't see it in the.R
file forgeom_link
. I am assuming it is some sort of sequence similarity?Thanks in advance!