ggseqlogo icon indicating copy to clipboard operation
ggseqlogo copied to clipboard

stack_with affects x axis tick positions

Open pwwang opened this issue 7 years ago • 0 comments

This is a great package with a lot of flexibilities!

But When I tried to adjust the width of the letters, the x axis moved! Notice the alignment between the ticks of ggseqlogo plot and the sequence letters in following plots.
If I used default stack_width, which is .95, I've got:

capture

Then if I set it to .5: capture2 The vertical grids became a little bit narrower, even though not so obvious by eyes.

But if I set it to 0.01: capture3 Note the relative positions of the ticks to the sequence letters, it is exactly what I want!

The sequences were plotted by ggplot2's geom_text, and the plots were arranged by gtable:

library(ggplot2)
library(ggseqlogo)
library(gtable)
library(grid)
# ... generating the  plots
g   <- gtable(unit(1, "npc"), unit(c(.7, .05, .05, .2), "npc"))
g   <- gtable_add_grob(g, gcurvgrob, 1, 1)
g   <- gtable_add_grob(g, gtable1grob, 2, 1)
g   <- gtable_add_grob(g, gtable2grob, 3, 1)
g   <- gtable_add_grob(g, glogogrob, 4, 1)
grid.newpage()
grid.draw(g)

If I just try to solely plot with ggseqlogo, with stack_width 0.95: capture5

For stack_width 0.01: capture4

You can easily tell the different padding from the first tick to the left border. Of course, as a single plot, it is completely OK, but I expect the stack_width shouldn't affect the tick positions so that we can better align the seqlogo to other plots.

By the way, the motif length is actually 9 (marked in the plots), the rest regions are filled with zeros.

Thanks!

pwwang avatar Dec 15 '17 22:12 pwwang