library(tidyverse)
DF <- read.table(text="Rank ReallySuperDuperlongname1 ReallySuperDuperlongname2 ReallySuperDuperlongname3
1 500 250 50
2 400 100 30
3 300 155 100
4 200 90 10", header=TRUE)
# this is close to what you have
DF %>%
gather(., trait, value, -Rank) %>%
ggplot(., aes(x = Rank, y = value, fill = trait)) +
geom_bar(stat = "identity", position="fill", width = 0.2) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), legend.position = "bottom") +
xlab(" ") +
guides(color = guide_legend(nrow = 2)) +
scale_x_discrete(expand = c(0, 0))
# if you change the width to 0.9 (the default) you get fat bars that fill the space
DF %>%
gather(., trait, value, -Rank) %>%
ggplot(., aes(x = Rank, y = value, fill = trait)) +
geom_bar(stat = "identity", position="fill", width = 0.9) +
theme_bw() +
theme(panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), legend.position = "bottom") +
xlab(" ") +
guides(color = guide_legend(nrow = 2)) +
scale_x_discrete(expand = c(0, 0))
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.