Adding a line to a stripplot #32
Answered
by
stefaneng
raagagrawal
asked this question in
Q&A
-
I am currently trying to add a x = 1 line to my stripplot in BPG. There doesn't seem to be an abline option like in other functions. Does anyone have any tips? |
Beta Was this translation helpful? Give feedback.
Answered by
stefaneng
Aug 4, 2022
Replies: 1 comment
-
I don't know how to do it directly with stripplot but you can always add plots together to combine the layers: simple.data <- data.frame(
x = c(rep(rnorm(50),5)),
y = as.factor(sample(LETTERS[1:5],250,TRUE))
);
my.plot <- create.stripplot(
formula = x ~ y,
data = simple.data,
) +
create.scatterplot(
formula = x ~ y,
# type = 'n' means don't plot the points since we already plotted with stripplot
type = 'n',
abline.h = 1,
abline.lty = 2,
data = simple.data
)
# Use this over `filename = ...` within plotting function
write.plot(my.plot) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
raagagrawal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know how to do it directly with stripplot but you can always add plots together to combine the layers: