Entering edit mode
2.7 years ago
Rob
▴
170
Hi all, I am using the following code to make a scatter plot for a few genes. I could be able to change the Y-axis to the same scale using ylim(). But this did not help for the x-axis.
- Does anyone know how I can change the values of the x-axis?
- I want to see the real values (the same scale for all scatters). Here I don't know why the dots are collected in one place? Also, how can I draw a vertical line that crosses the x-axis from a specific value such as 80 in the x-axes?
R-code:
dat <- read.csv("mydata.csv", check.name = FALSE, stringsAsFactors = FALSE, header = T)
df <- as.data.frame(dat)
# Basic scatter plot
ex <- melt(df, id.vars="NumericValue")
colnames(ex) <- c("NumericValue","gene", "exprs")
ggplot(data=ex, aes(x="NumericValue", y=exprs)) + geom_point() +
facet_wrap(~ gene, scales = "free") +
ylim(0, 15) +
theme_bw()
Resutlted plot:
Thanks Atpoint Also di you know how I can add a vertical line to my plots?
geom_vline?
Great! It worked.
Thanks ATpoint