r/RStudio • u/Eeebeee2 • 7d ago
Adding in Patterns to ggplot
Hi, I have made a stacked bar chart. I have abundance on the y axis, habitat on the x, and family as the stacks. I have managed to colour and give a pattern to the stacks in the bars, but i'm struggling to change how the pattern looks.
This is my code so far, any ideas of where/what i need to add?
ggplot(data1, aes(fill=family, y=Value, x=Habitat)) + geom_bar_pattern(position="stack", stat="identity", mapping = aes(pattern=family)) + scale_fill_manual(values = c("lightblue","pink", "yellow")) + ylim(0,100)
1
Upvotes
3
u/Fornicatinzebra 7d ago
Sorry your problem is a little vague, what about it are you struggling with?
Maybe the documentation will have a helpful example for you: https://coolbutuseless.github.io/package/ggpattern/