nicholasehamilton / ggtern

Extension to ggplot2 for plotting ternary diagrams
www.ggtern.com
55 stars 14 forks source link

Example from vignette doesn't work with ggplot 3.2.1.9000 (Error: $ operator is invalid for atomic vectors) #41

Open werkstattcodes opened 4 years ago

werkstattcodes commented 4 years ago

I am getting an error (Error: $ operator is invalid for atomic vectors) when using ggtern and the latest ggplot dev version. Any idea?

library(ggtern)
#> Warning: package 'ggtern' was built under R version 3.6.2
#> Loading required package: ggplot2
#> Registered S3 methods overwritten by 'ggtern':
#>   method           from   
#>   +.gg             ggplot2
#>   grid.draw.ggplot ggplot2
#>   plot.ggplot      ggplot2
#>   print.ggplot     ggplot2
#> --
#> Remember to cite, run citation(package = 'ggtern') for further info.
#> --
#> 
#> Attaching package: 'ggtern'
#> The following objects are masked from 'package:ggplot2':
#> 
#>     %+%, aes, annotate, calc_element, ggplot, ggplot_build,
#>     ggplot_gtable, ggplotGrob, ggsave, layer_data, theme, theme_bw,
#>     theme_classic, theme_dark, theme_gray, theme_light, theme_linedraw,
#>     theme_minimal, theme_void
library(tidyverse)

df = data.frame(x = runif(50),
                y = runif(50),
                z = runif(50),
                Value = runif(50,1,10),
                Group = as.factor(round(runif(50,1,2))))
ggtern(data=df,aes(x,y,z,color=Group)) +
  theme_rgbw() +
  geom_point() + geom_path() +
  labs(x="X",y="Y",z="Z",title="Title")
#> Error: $ operator is invalid for atomic vectors


sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18362)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_Austria.1252  LC_CTYPE=English_Austria.1252   
#> [3] LC_MONETARY=English_Austria.1252 LC_NUMERIC=C                    
#> [5] LC_TIME=English_Austria.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] forcats_0.4.0      stringr_1.4.0      dplyr_0.8.3        purrr_0.3.3       
#>  [5] readr_1.3.1        tidyr_1.0.0        tibble_2.1.3       tidyverse_1.3.0   
#>  [9] ggtern_3.1.0       ggplot2_3.2.1.9000
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.3          lubridate_1.7.4     lattice_0.20-38    
#>  [4] assertthat_0.2.1    zeallot_0.1.0       digest_0.6.23      
#>  [7] R6_2.4.1            cellranger_1.1.0    plyr_1.8.5         
#> [10] backports_1.1.5     reprex_0.3.0        evaluate_0.14      
#> [13] httr_1.4.1          highr_0.8           pillar_1.4.2       
#> [16] rlang_0.4.2         compositions_1.40-3 readxl_1.3.1       
#> [19] rmarkdown_1.18      proto_1.0.0         munsell_0.5.0      
#> [22] broom_0.5.2         compiler_3.6.1      modelr_0.1.5       
#> [25] xfun_0.11           pkgconfig_2.0.3     htmltools_0.4.0    
#> [28] tidyselect_0.2.5    tensorA_0.36.1      gridExtra_2.3      
#> [31] fansi_0.4.0         crayon_1.3.4        dbplyr_1.4.2       
#> [34] withr_2.1.2         MASS_7.3-51.4       grid_3.6.1         
#> [37] nlme_3.1-140        bayesm_3.1-4        jsonlite_1.6       
#> [40] gtable_0.3.0        lifecycle_0.1.0     DBI_1.0.0          
#> [43] magrittr_1.5        scales_1.1.0        cli_2.0.0          
#> [46] stringi_1.4.3       fs_1.3.1            robustbase_0.93-5  
#> [49] xml2_1.2.2          vctrs_0.2.0         generics_0.0.2     
#> [52] latex2exp_0.4.0     tools_3.6.1         glue_1.3.1         
#> [55] DEoptimR_1.0-8      hms_0.5.2           yaml_2.2.0         
#> [58] colorspace_1.4-1    rvest_0.3.5         knitr_1.26         
#> [61] haven_2.2.0

Created on 2020-01-20 by the reprex package (v0.3.0)