This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Scatter plot for two data sets

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

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

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.

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

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

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

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

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.

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

0 answers

No answers yet.

Log in to answer this question.