Skip to content

Determining/forcing a uniform logo symbols stack order #3

Description

@mathieudupont

With position="classic", is there a way to force the (vertical) order of the symbols, instead of using the frequency values? For example, if my symbols are "A", "C", "G" and "U" and I would like them to be always A on top of C, C on top of G and G on top of U, for each position, no matter what are their respective frequencies, how can I force that?
In the following minimal example, I would like the two stacks to be in the ACGU order.
Thank you!

library(ggplot2)
library(gglogo)

position = c(1, 1, 1, 1, 2, 2, 2, 2)
element = c("A", "C", "G", "U", "A", "C", "G", "U")
freq = c(0.27, 0.26, 0.24, 0.23, 0.26, 0.27, 0.23, 0.24)
d = data.frame(position, element, freq)

figure = ggplot(data=d) +
geom_logo(aes(x=position, y=freq, label=element, fill=element), position="classic")

pdf("minimal_example.pdf")
print(figure)
dev.off()

minimal_example.pdf

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions