延长X轴间隔ggplot2

时间:2015-09-09 14:38:51

标签: r ggplot2 scale overlap

我试图用很多X轴值绘制数据。我试图不与geom_point重叠我的观点。我发现很多关于“scale_x_continuous”,“position = jitter或fodge”等的讨论......每次我的问题都存在,因为我需要保持我的观点一致。而且,“scale_size_area”并不能很好。

编辑:生成的数据已在帖子结束时融化。

我无法发布图片(Link to image),但是想出一个主意:我的Y轴有6个等级,X轴有400个等级。我的点(形状= 1 =圆)是Y水平对齐的,并且根据值具有不同的直径。

这没关系,但圆圈重叠。

plot <- ggplot(data, aes(x_variable_400_levels, y_variable_6_levels)) + 

        # value*100 because values are between 0 and 1 to have bigger circles
        geom_point(shape = 1, size = data$value*100) +

        # theme description
        theme(
              plot.title = element_text(lineheight=.8, face="bold", vjust=1),
              axis.title.x = element_text(vjust=-0.5),
              axis.title.y = element_text(vjust=0.3)
        )

所以,我的问题是:我可以修改X轴的两个值之间的间隔,以避免圆圈之间的重叠吗?抖动在这里并不有趣,因为噪声不能很好地显示数据,包括当我试图只有HORIZONTAL噪声时。

任何类型的解决方案,链接或其他解决方案的教程将不胜感激。

编辑:生成的数据。使用read.table,sep =“,”和header = T导入。关键是,我的圈子很少,而且它们也很重要。

data <- read.table(text='"trf","sample","value"
                   36,"S1",0.143882104
                   38,"S1",0.025971979
                   47,"S1",0.016711593
                   56,"S1",0.027896069
                   67,"S1",0.025870577
                   93,"S1",0.07638307
                   100,"S1",0.022905895
                   102,"S1",0.019192547
                   104,"S1",0.018258923
                   107,"S1",0.005032219
                   114,"S1",0.028297368
                   123,"S1",0.007874848
                   131,"S1",0.024184004
                   36,"S2",0.115123666
                   38,"S2",0
                   47,"S2",0.00479275
                   56,"S2",0.029523128
                   67,"S2",0.030133055
                   93,"S2",0.044749246
                   100,"S2",0.032865979
                   102,"S2",0
                   104,"S2",0
                   107,"S2",0.013160255
                   114,"S2",0.052047248
                   123,"S2",0.007632445
                   131,"S2",0
                   36,"S3",0.179332128
                   38,"S3",0.046215267
                   47,"S3",0
                   56,"S3",0.070791832
                   67,"S3",0.050214857
                   93,"S3",0.074108014
                   100,"S3",0
                   102,"S3",0
                   104,"S3",0
                   107,"S3",0
                   114,"S3",0.081441849
                   123,"S3",0
                   131,"S3",0.100090456', header=T,sep=",")

0 个答案:

没有答案