trevorld / ggpattern

ggplot geoms with pattern fills
https://trevorldavis.com/R/ggpattern/dev/
Other
359 stars 18 forks source link

Reverse stripe angles #29

Closed caston60 closed 3 years ago

caston60 commented 3 years ago

A much needed addition to the ggplot world, thank you.

Having an issue with controlling the angle and I cannot seem to find a solution on the web. I can set an angle to 45 and have nice stripes from lower left to upper right, but I also need bars with the reverse stripe: from upper left to lower right. I have tried setting pattern_angle = -45, 135 and 315 but to no avail (I just get vertical stripes). What am I missing here?

-chris

trevorld commented 3 years ago

Please provide a minimal reproducible-example. As far as I can tell reverse stripe angles work as expected (setting pattern_angle to -45, 135, or 315 all work).

library("ggpattern")
library("ggplot2")

df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
ggplot(df, aes(trt, outcome)) +
    geom_col_pattern(aes(fill=trt),colour='black', pattern = 'stripe', pattern_angle = 135)

reverse_stripe

trevorld commented 3 years ago

No minimal reproducible-example provided.