scatter plot change in x, y axis
1
0
Entering edit mode
2.0 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.

  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 • 800 views
ADD COMMENT
2
Entering edit mode
2.0 years ago
ATpoint 82k

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

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

geom_vline?

ADD REPLY
0
Entering edit mode

Great! It worked.

Thanks ATpoint

ADD REPLY

Login before adding your answer.

Traffic: 2794 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6