Hi,
I have the long format data created for the purpose of the line plot. Each gene is mapped to unique ID arranged in the last column which would be beneficial during plotting. Example of the data is mentioned below and along with the screenshot of the output. I have two questions,
This is plotted just with the few IDs (last column), I have more than hundred IDs and saving the pdf looks fuzzy. Is there a way to include all the plots corresponding to the ID by setting margins in the pdf report.
Include the gene names inside each ID box, as separate legend occupies more space and not very interpretive in case of large data.
Please assist me with this.
Multiple line plots
dput(head(final))
structure(list(Genes = structure(c(1L, 1L, 1L, 1L, 2L, 2L), .Label = c("Gene_A",
"Gene_B", "Gene_C", "Gene_D", "Gene_E", "Gene_F", "Gene_G", "Gene_H",
"Gene_I", "Gene_K", "Gene_L", "Gene_M", "Gene_N", "Gene_O", "Gene_P",
"Gene_R", "Gene_S", "Gene_T"), class = "factor"), Timepoints = c("1",
"2", "3", "5", "1", "2"), value = c("-2.05066", "-0.657222",
"-1.49477", "-1.80191", "-8.35787", "-9.52402"), X5 = structure(c(Gene_A = 1L,
Gene_A = 1L, Gene_A = 1L, Gene_A = 1L, Gene_B = 2L, Gene_B = 2L
), .Label = c("A1.1", "A1.2", "A1.3", "A1.4", "A1.5", "A1.6",
"A1.9", "A2.2", "A2.6"), class = "factor")), row.names = c(NA,
6L), class = "data.frame")
final %>%
ggplot(aes(x = Timepoints , y = value , group = Genes)) +
geom_point() +
geom_line(alpha = 1 , aes(col = as.character(Genes))) +
theme_bw() +
theme(legend.position = "right" , axis.text.x = element_text(angle = 90 , vjust = 0.4)) +
facet_wrap(~X5)
Thank you,
Toufiq
See this related StackOverflow post:
@ zx8754,
Thank you very much for the suggestions.