r - ggplot2 plotting with black outline -
i cross posting forum (https://www.biostars.org/p/268514/#268559) got useful comments still confused output of ggplot2.
i trying simple black outline on circles code giving random colours , seems ignoring scale_colour_manual(values = cols) argument. when run following code:
# creating color palette > cols <- c("red" = "red", "orange" = "orange", "nonsignificant" = "darkgrey", "increased" = "#00b2ff", "decreased" = "#00b2ff") # make basic ggplot2 object > vol <- ggplot(data, aes(x = lfc, y = pval, color = color, labels=gene)) # inserting mnaual colors per color pallette term "scale_colour_manual(values = cols)" below > vol + ggtitle(label = "volcano plot", subtitle = "colored fold-change direction") + geom_point(size = 2.5, alpha = 1, na.rm = t) + scale_colour_manual(values = cols) + theme_bw(base_size = 14) + theme(legend.position = "right") + xlab(expression(log[2]("vitd" / "carrier"))) + ylab(expression(-log[10]("fdr"))) + # change y-axis label geom_hline(yintercept = 1, colour="#990000", linetype="dashed") + geom_vline(xintercept = 0.586, colour="#990000", linetype="dashed") + geom_vline(xintercept = -0.586, colour="#990000", linetype="dashed") + scale_y_continuous(trans = "log1p") i beautiful graph defined colour palette:

next, want add border points , change 2 pieces of code. @ start make basic ggplot object "fill = color" instead of "color = color"
> vol <- ggplot(data, aes(x = lfc, y = pval, fill = color, labels=gene)) and add "shape = 21, colour = "black"" "geom_point" argument:
> vol + ggtitle(label = "volcano plot", subtitle = "colored fold-change direction") + geom_point(size = 2.5, alpha = 1, na.rm = t, shape = 21, colour = "black") + scale_colour_manual(values = cols) + theme_bw(base_size = 14) + theme(legend.position = "right") + xlab(expression(log[2]("vitd" / "carrier"))) + ylab(expression(-log[10]("fdr"))) + l geom_hline(yintercept = 1, colour="#990000", linetype="dashed") + geom_vline(xintercept = 0.586, colour="#990000", linetype="dashed") + geom_vline(xintercept = -0.586, colour="#990000", linetype="dashed") + scale_y_continuous(trans = "log1p") and have plot seems random selection of 5 colours; , if print colors:
print(cols) red orange nonsignificant increased decreased "red" "orange" "darkgrey" "#00b2ff" "#00b2ff" the palette still there.
when change color = cols fill = cols, should change scale_color_manual(...) scale_fill_manual(...)
wiki
Comments
Post a Comment