Skip to content

Adding a line to a stripplot #32

Answered by stefaneng
raagagrawal asked this question in Q&A
Discussion options

You must be logged in to vote

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)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raagagrawal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants