Skip to content

Different color/line type for vertical and horizontal ablines #65

Discussion options

You must be logged in to vote
library(BoutrosLab.plotting.general);
set.seed(12345);

simple.data <- data.frame(
    x = rnorm(800),
    y = rnorm(800)
    );

Different color ablines are easy when both are horizontal/vertical. We can pass in a vector of line positions to either abline.h or abline.v and a vector of the same size (or length 1) to abline.lty, abline.lwd, abline.col, etc.

plot1 <- create.scatterplot(
    formula = y ~ x,
    data = simple.data,
    abline.h = c(2, 1),
    abline.lty = c(2, 3),
    abline.lwd = 3,
    abline.col = default.colours(2),
    );

plot1;

Changing color or line type for ablines when some are horizontal and some are vertical is less intuitive but still possible in BPG.
We still s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stefaneng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant