Facet plots in `geom_logo` should follow ggplot2 conventions
MattBrauer opened this issue · 4 comments
Plotting multiple sequence logos is accomplished by passing a named list of sequences. ASAIK, this is not a standard mechanism for multiple plots.
What I'd like to do is something that aligns more with the tidy workflow, like:
seq_tbl %>% ggplot() + geom_logo(sequence) + theme_logo() + facet_wrap(~sample, ncol=2)
rather than:
ggplot() + geom_logo(list_of_sequences) + theme_logo() + facet_wrap(~seq_group, ncol=2)
where sequence
and sample
are both columns in my tibble.
As it now stands, I need to pass a named list of sequences and use a mystery variable (seq_group?) for the faceting.
Also, is there any way to set the order of the plots in the facet_wrap or facet_grid?
Thanks.
I agree it would be more flexible and in line with gg convention.
The initial implementation of the package was never meant to allow for interfacing with geom_logo/ggplot2. It was only a wrapper, which is now the functionggseqlogo
. I added the support for that later on to allow more flexibility customizing the plot.
I don't have much time to make changes, but you are welcome to submit a pull request if you'd like to take a stab at it.
Not at all- I always welcome feedback! :)
Forgot to response to your question: the order of the facet is the same order of the list so you would just change that. e.g.
require(ggseqlogo)
data(ggseqlogo_sample)
ggseqlogo( seqs_dna[c(1, 2, 3)], ncol = 1 )
ggseqlogo( seqs_dna[c(3, 1, 2)], ncol = 1 )
Hope that helps!