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

Customizing colours results in wrong/modified/faded colours #2

Open
mathieudupont opened this issue Oct 25, 2016 · 0 comments
Open

Comments

@mathieudupont
Copy link

mathieudupont commented Oct 25, 2016

When I customize colours with scale_fill_manual(), the colours in the logo are not the exact colours specified. For example, a red "#FF0000" does not result in the "#FF0000" red. It seems that the colours' hue gets somehow modified to be less saturated or something. Is there a way to bypass this modification and impose exact colours?
Here is a minimal example, where the text blue and red are right, but the blue and red of the nucleotides should be the same, and it is obviously different.
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") +
scale_fill_manual(values=c("#00FF00", "#FFFFFF", "#FF0000", "#0000FF")) +
annotate("text", x=1.5, y=0.875, label="This text is in #FF0000 RED", size=9, fontface="bold", colour="#FF0000") +
annotate("text", x=1.5, y=0.625, label="This text is in #0000FF BLUE", size=9, fontface="bold", colour="#0000FF")

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

minimal_example.pdf

@mathieudupont mathieudupont changed the title Customizing colours results in wrong/modified/faded colours. Customizing colours results in wrong/modified/faded colours Oct 25, 2016
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