Question: (Closed) ggplot2 returns empty plot
0
gravatar for F
4 months ago by
F3.4k
Iran
F3.4k wrote:

Hi,

I am trying to determine copy number in tumor and normal sample, so I calculated depth and so on by mosdepth and I finished with this table

https://www.dropbox.com/s/11jlie6kufibg4y/all_depth.txt?dl=0

> head(all_depth)
      Chr Start Counts.100Tumor Counts.100Normal       diff
    1   1     0            0.00          0.00000   0.000000
    2   1 10000           55.21         69.75838 -14.548375
    3   1 20000           32.24         34.81226  -2.572259
    4   1 30000           33.36         36.21775  -2.857753
    5   1 40000           24.45         26.22632  -1.776319
    6   1 50000           35.73         34.33420   1.395800
    > 


ggplot(all_depth[all_depth$Chr == "chr6",], aes(x=Start, y=diff, color=diff)) + geom_point() + scale_color_viridis("Depth", option = "plasma")

I was going to plot that like this picture from tutorial

enter image description here

But R gives me an empty plot, do you know why? I don't know where I am doing wrong I even tried for all chromosomes

cnv ggplot2 R software error • 247 views
ADD COMMENTlink written 4 months ago by F3.4k
3

all_depth$Chr == "chr6" Chr -> 6 !!! But I guess you also got an error

ADD REPLYlink modified 4 months ago • written 4 months ago by Ido Tamir5.0k

This solves the problem, F?

ADD REPLYlink written 4 months ago by Kevin Blighe46k

Yes and returned this frustrating plot

enter image description here

ADD REPLYlink modified 4 months ago • written 4 months ago by F3.4k
1

Good evening. You have an extreme outlier with a value of ~1260. The other points are 'squashed' on the 0 line because the plot window is too small. Try to change the value of xlim()

ADD REPLYlink written 4 months ago by Kevin Blighe46k

Hello F!

We believe that this post does not fit the main topic of this site.

Not related to bioinformatics, didn't work because of typo: "chr6" should b 6, also check the class of the column class(all_depth$Chr).

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink modified 4 months ago • written 4 months ago by zx87547.9k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 539 users visited in the last hour