Entering edit mode
2.7 years ago
Rob
▴
170
Hi friends
I have a data file of gene expression, normalized. The first column is genes, the first raw is continuous values I want to be in X axis.
I want to have a plot for each gene separately: Y axis: gene expression, X axis: first raw of this data file.
Is there any code to do this in R? this is how my data looks like:
What type of plot? You can do scatter plot, line plot, bar plot, etc.
But the simplest way is to use the R base function plot(). If you have two vectors x and y, the plot(x, y) function will simply plot a scatter plot of y as a function of x. So if you can read this table into a data frame or matrix - ignoring the first column - you can simply call plot(df[1, ], df[i, ]) to plot the ith row.
For more fancy plots you can use the package ggplot2 like this
Thanks Soheil It is a bit difficult to plot one by one like df[1,]...df[I,]) as I have many genes. I want one scatter plot for each gene and I want them to be in one page. I believe it should be through facet () but I don't know how it works.
Is there any code for this?