Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting alignment in wide format #56

Open
vhfsantos opened this issue Feb 20, 2023 · 1 comment
Open

Plotting alignment in wide format #56

vhfsantos opened this issue Feb 20, 2023 · 1 comment

Comments

@vhfsantos
Copy link

Hi,
Thank you so much for this amazing package!

I was wondering if there is a way of making the alignment plot wider (i.e., bigger in width, than in height).
I am working with a matrix of 200 sequences, with 70nt each. I plotted the alignment with:

ggmsa(seq, seq_name = F,
            char_width = 0.5,
            font = NULL, border = NA, color = "Chemistry_NT") +
            geom_seqlogo(color = "Chemistry_NT")

Which resulted in the following alignment:

original

However, I would like to generate a wider visualization, like this (edited with an image editing tool):

wider

I tried to address this by changing the size parameters of a downstream ggsave() call, but it doesn't affect the width/height of the alignment matrix itself, only the size of the device (e.g., the output png image). Do you know how can I generate this straight from ggmsa(), without needing external image editing tools?

You can find the fasta file here, in case you want it.

Best,
Vinícius

@jayoung
Copy link

jayoung commented Jan 4, 2024

I was wondering the same thing, and I think I figured it out. Adding a facet_msa layer, although it doesn't seem necessary, it seems to mean that the plot respects the dimensions specified by ggsave:

p <- ggmsa(seq, seq_name = F,
           char_width = 0.5,
           font = NULL, border = NA, color = "Chemistry_NT") +
    facet_msa(field=80) +
    geom_seqlogo(color = "Chemistry_NT")
ggsave(filename = "ggmsa_testPlot.pdf", p, height=3, width=11)

I don't understand why, but I like that it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants