Question: (Closed) ggplot2 returns empty plot
gravatar for F
25 days ago by
F3.4k wrote:


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

> 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 • 144 views
ADD COMMENTlink written 25 days ago by F3.4k

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

ADD REPLYlink modified 25 days ago • written 25 days ago by Ido Tamir5.0k

This solves the problem, F?

ADD REPLYlink written 25 days ago by Kevin Blighe41k

Yes and returned this frustrating plot

enter image description here

ADD REPLYlink modified 25 days ago • written 25 days ago by F3.4k

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 25 days ago by Kevin Blighe41k

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.


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


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