什么是ggplot中的discreteRangeGenerator错误?

时间:2018-08-03 15:04:28

标签: r ggplot2

我有一个要在ggplot中绘制的对象。在我最近升级R版本之前和之后,都在使用该对象和代码进行绘图,这在下面给了我以下错误。

数据:

test<- structure(list(Pos = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 
24L, 1L), Nucleotides = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 2L), .Label = c("A", "C", "G", "T"), class = "factor"), Mismatches = c(0.0870574579222287, 
0.464306442251886, 0, 0.435287289611143, 0.174114915844457, 0.348229831688915, 
0.145095763203714, 1.015670342426, 0.551363900174115, 0.261172373766686, 
0.261172373766686, 0.116076610562972, 0.174114915844457, 0.0870574579222287, 
0.174114915844457, 0.261172373766686, 0.319210679048172, 0.0580383052814858, 
0.4062681369704, 0.174114915844457, 0.232153221125943, 0.261172373766686, 
3.2501450957632, 24.1149158444573, 1.24782356355194), Samples = structure(c(2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Ago2_SsHV2L_1_CATGGC_L003_R1_001", 
"Ago2_SsHV2L_2_CATTTT_L003_R1_001"), class = "factor"), Read.Length = c("24", 
"24", "24", "24", "24", "24", "24", "24", "24", "24", "24", "24", 
"24", "24", "24", "24", "24", "24", "24", "24", "24", "24", "24", 
"24", "24")), .Names = c("Pos", "Nucleotides", "Mismatches", 
"Samples", "Read.Length"), reshapeLong = structure(list(varying = list(
    c("A", "C", "G", "T")), v.names = "Mismatches", idvar = "Pos", 
    timevar = "Nucleotides"), .Names = c("varying", "v.names", 
"idvar", "timevar")), row.names = c("1.A", "2.A", "3.A", "4.A", 
"5.A", "6.A", "7.A", "8.A", "9.A", "10.A", "11.A", "12.A", "13.A", 
"14.A", "15.A", "16.A", "17.A", "18.A", "19.A", "20.A", "21.A", 
"22.A", "23.A", "24.A", "1.C"), class = "data.frame")

p <- ggplot(test) +
geom_point(aes(x=Pos, y = Mismatches, color = Read.Length,group = Samples, shape = Samples, size = Nucleotides))+
# geom_point(aes(x=Pos, y = Mismatches, color = Read.Length,group = Samples, shape = Samples))+
scale_shape_manual(values=1:nlevels(all.data$Samples)) +
scale_x_continuous(breaks = c(1,seq(2,24,2)))+ 
theme_bw() +
theme(axis.line = element_line(colour = "black"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank()) +
scale_color_manual(values = c("lavender", "darkslategray2", "darkseagreen4", "yellow", "blue", "red","deeppink4"))+
theme(text = element_text(size=12),
      axis.text.x = element_text(angle=90, hjust=1))+
theme(axis.text=element_text(size=14),
      axis.title=element_text(size=14,face="bold"))



Error in DiscreteRange$new() : `inherit` must be a R6ClassGenerator.
In addition: Warning messages:
1: In structure(NULL, class = "waiver") :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(NULL, class = "waiver") :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

Sessioninfo:

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] ggplot2_1.0.1        reshape2_1.4.3       scales_0.5.0        
[4] dplyr_0.7.6          tidyr_0.8.1          BiocInstaller_1.18.5

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18     bindr_0.1.1      magrittr_1.5     MASS_7.3-50     
 [5] tidyselect_0.2.4 munsell_0.5.0    colorspace_1.3-2 R6_2.2.2        
 [9] rlang_0.2.1      stringr_1.3.1    plyr_1.8.4       tools_3.4.4     
[13] grid_3.4.4       gtable_0.2.0     assertthat_0.2.0 yaml_2.2.0      
[17] digest_0.6.15    tibble_1.4.2     crayon_1.3.4     bindrcpp_0.2.2  
[21] purrr_0.2.5      glue_1.3.0       stringi_1.2.4    compiler_3.4.4  
[25] pillar_1.3.0     pkgconfig_2.0.1  proto_1.0.0     

0 个答案:

没有答案