Scatter plot for two data sets
0
0
Entering edit mode
6.9 years ago
saj98 ▴ 140

Hello every one

I have two CSV files from different RNA seq data, I like to do scatter plot to study the similarity between both experiments. I do not know how to plot two different variables from two different files. Do you have any suggestion or idea how to plot two different data sets? Thanks for help

RNA-Seq R • 3.5k views
ADD COMMENT
1
Entering edit mode

Hi, do the data have the same length? If you import the data with data1 = read.csv() and data2 = read.csv(), can't you then do:

plot(data1$variable1, data2$variable2)

? C.

ADD REPLY
0
Entering edit mode

Yes the data frame is similar, but the labels are different between the two files. The first experiment done on cells and the second experiment done on tissue. I did what you asked me so I got this error plot(G$AF.Cell, G1$AF.tissue) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ

ADD REPLY
1
Entering edit mode

So you know where the error is then? Could you post the code you've used to fix the problem, please

ADD REPLY
0
Entering edit mode

Sure, I am pasting it

 G <- read.csv(file.choose(), header = TRUE, sep = ",")
> head(G)
    gene  AD.tissue
1  ACA64 132.412000
2 Acaa1a   6.530200
3  Acaa2  12.099600
4  Acaca   5.238780
5  Acacb   0.799083
6 Acad10   5.033970
> G1 <- read.csv(file.choose(), header = TRUE, sep = ",")
> head(G1)
  geneNames      AF.Cell
1     ACA64 4.562277e+02
2     Acaca 1.676200e+01
3     Acaca 8.086103e+01
4     Acacb 3.741280e-02
5     Acacb 5.041820e-02
6     Acacb 5.890000e-07
> plot(G$AD.tissue, G1$AF.Cell)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ
ADD REPLY
0
Entering edit mode

Sorry, could you post it in your initial question and format it. Please indicate which of those columns could be used to match rows in one dataset with rows in the other, and I might be able to help you

ADD REPLY
1
Entering edit mode

You need a gene-level average before you can compare the results in one dataset with the results in the other, which is unfortunate, since if you had at most one entry for each gene, it would be a simple case of merge with by.x="gene", by.y="geneNames" then plot.

ADD REPLY
0
Entering edit mode

I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

ADD REPLY
0
Entering edit mode

I think ther's a swirl tutorial on base R graphics in the R Programming course see here

ADD REPLY

Login before adding your answer.

Traffic: 2648 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