geom_interpolate_tern not working

Issue #15 new
Daniel Victoria created an issue

Just tried `geom_interpolate_tern` and recieved the following warning message:

Warning message:
Computation failed in stat_interpolate_tern():
Number of x coordinates must match number of columns in density matrix.

The plot is created without the interpolated geometry.

Here is a reprex using the exemple from the website:

library(ggtern)
#> Loading required package: ggplot2
#> Registered S3 methods overwritten by 'ggtern':
#>   method           from   
#>   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, ggplot, ggplot_build, ggplot_gtable, ggplotGrob,
#>     ggsave, layer_data, theme_bw, theme_classic, theme_dark,
#>     theme_gray, theme_light, theme_linedraw, theme_minimal, theme_void
data(Feldspar)
ggtern(Feldspar,aes(Ab,An,Or,value=T.C)) + 
  stat_interpolate_tern(geom="polygon",
                        formula=value~x+y,
                        method=lm,n=100,
                        breaks=seq(0,1000,by=100),
                        aes(fill=..level..),expand=1) +
  geom_point()
#> Warning: Computation failed in `stat_interpolate_tern()`:
#> Number of x coordinates must match number of columns in density matrix.

sessionInfo()
#> R version 4.0.0 (2020-04-24)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
#> 
#> locale:
#>  [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=pt_BR.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggtern_3.3.0  ggplot2_3.3.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] latex2exp_0.4.0     Rcpp_1.0.4.6        DEoptimR_1.0-8     
#>  [4] pillar_1.4.4        compiler_4.0.0      highr_0.8          
#>  [7] plyr_1.8.6          compositions_1.40-5 tools_4.0.0        
#> [10] digest_0.6.25       evaluate_0.14       lifecycle_0.2.0    
#> [13] tibble_3.0.1        gtable_0.3.0        lattice_0.20-41    
#> [16] pkgconfig_2.0.3     rlang_0.4.6         yaml_2.2.1         
#> [19] xfun_0.14           proto_1.0.0         gridExtra_2.3      
#> [22] withr_2.2.0         stringr_1.4.0       dplyr_0.8.5        
#> [25] knitr_1.28          vctrs_0.3.0         isoband_0.2.1      
#> [28] grid_4.0.0          tidyselect_1.1.0    robustbase_0.93-6  
#> [31] glue_1.4.1          R6_2.4.1            bayesm_3.1-4       
#> [34] rmarkdown_2.1       tensorA_0.36.1      farver_2.0.3       
#> [37] purrr_0.3.4         magrittr_1.5        MASS_7.3-51.6      
#> [40] scales_1.1.1        ellipsis_0.3.1      htmltools_0.4.0    
#> [43] assertthat_0.2.1    colorspace_1.4-1    labeling_0.3       
#> [46] stringi_1.4.6       munsell_0.5.0       crayon_1.3.4

<sup>Created on 2020-05-27 by the reprex package (v0.3.0)</sup>

Comments (0)

  1. Log in to comment