ggseqlogo
ggseqlogo copied to clipboard
Change numbers on the x-axis of logos
I'm trying to plot some sequences upstream of a start codon. The more intuitive way to number these sequences would be starting from -10 on the left ending at -1 on the right side.
Is there any way to get this packages to accept a vector specifying custom numbering below the logos?
This is a ggplot question rather than a ggseqlogo question. ggseqlogo just builds on top of ggplot. A quick Google will show you how to change axis labels in ggplot2
https://stackoverflow.com/questions/20529252/changing-x-axis-tick-labels-in-r-using-ggplot2
On May 25, 2022, at 4:31 PM, maximus-sci @.***> wrote:
I'm trying to plot some sequences upstream of a start codon. The more intuitive way to number these sequences would be starting from -10 on the left ending at -1 on the right side.
Is there any way to get this packages to accept a vector specifying custom numbering below the logos?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
Thanks for responding and for the link. I tried:
ggseqlogo(upstreamSeqList) +
scale_x_discrete(labels = seq(from = -10,to = -1, by = 1))
and also tried coercing the labels to a character vector. In both cases the numbers just disappear from the plots entirely. And I get the message:
Scale for 'x' is already present. Adding another scale for 'x', which will replace the existing scale.
From that error I'd expect to see the new labels appear, but instead I get no labels at all...so I was thinking that the scale was being set some other way inside the ggseqlogo function.
Assuming p
is the ggplot2 object plotted with ggseqlogo:
p$scales$scales[[1]]$labels <- new_labels