p0 <- df |>
tidyplot(x = log2FoldChange, y = neg_log10_padj) |>
add_data_labels_repel(
data = min_rows(padj, 6, by = direction),
label = external_gene_name,
color = "#000000",
min.segment.length = 0,
background = TRUE,
fontface = "italic") |>
adjust_x_axis_title("$Log[2]~fold~change$") |>
adjust_y_axis("$-Log[10]~italic(P)~adjusted$")
# Save vector images without rasterization
p0 |>
add_data_points(data = filter_rows(!candidate), color = "#dddddd") |>
add_data_points(
data = filter_rows(candidate, direction == "up"),
color = "#bb5566", alpha = 0.5) |>
add_data_points(
data = filter_rows(candidate, direction == "down"),
color = "#004488", alpha = 0.5) |>
add_reference_lines(x = c(-1, 1), y = -log10(0.05)) |>
save_plot("images/rasterize_volcano_no.pdf", view_plot = FALSE) |>
save_plot("images/rasterize_volcano_no.svg", view_plot = FALSE)
# Save vector images with rasterization (dpi = 100)
p0 |>
add_data_points(data = filter_rows(!candidate), color = "#dddddd",
rasterize = TRUE, rasterize_dpi = 100) |>
add_data_points(
data = filter_rows(candidate, direction == "up"), color = "#bb5566",
alpha = 0.5, rasterize = TRUE, rasterize_dpi = 100) |>
add_data_points(
data = filter_rows(candidate, direction == "down"), color = "#004488",
alpha = 0.5, rasterize = TRUE, rasterize_dpi = 100) |>
add_reference_lines(x = c(-1, 1), y = -log10(0.05)) |>
save_plot("images/rasterize_volcano_yes_dpi100.pdf", view_plot = FALSE) |>
save_plot("images/rasterize_volcano_yes_dpi100.svg", view_plot = FALSE)