This is a test version of Biostars. For the public version, visit https://www.biostars.org.
scatter plot change in x, y axis

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.

  1. Does anyone know how I can change the values of the x-axis?
  2. 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:

DEGs-Specific

scatter code expression r

1 answer

Unquote, it aes(x=NumericValue, y=exprs).

Thanks Atpoint Also di you know how I can add a vertical line to my plots?

geom_vline?

Great! It worked.

Thanks ATpoint

Log in to answer this question.