Skip to content

textplot_xray() does not display terms at the top of plot #1514

@stefan-mueller

Description

@stefan-mueller

Describe the bug

textplot_xray() displays the occurrences of terms correctly, but does not print the terms at the top of the plot anymore (and shows NA instead). Not sure whether this is caused by a change in ggplot2 or due to changes in quanteda. @amatsuo, could you have a look?

Reproducible code

library(quanteda)
#> Package version: 1.3.17

data_corpus_inauguralPost70 <- corpus_subset(data_corpus_inaugural, Year > 1970)

# KWIC still working

head(kwic(data_corpus_inauguralPost70, pattern = "american"), 2)
#>                                                                   
#>   [1973-Nixon, 832]      the God-given right of every | American |
#>  [1973-Nixon, 1504] the cherished birthright of every | American |
#>                               
#>  to full and equal opportunity
#>  . Above all else,

# texplot_xray does not show term(s) above plot, but NA

textplot_xray(kwic(data_corpus_inauguralPost70,  "american"))

textplot_xray(kwic(data_corpus_inauguralPost70, pattern = "american"))

textplot_xray(kwic(data_corpus_inauguralPost70, pattern = "america*"), 
              kwic(data_corpus_inauguralPost70, pattern = "people"))

Expected behavior

The term(s) should be printed at the top of the plot through ggplot2::facet_grid().

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_IE.UTF-8/en_IE.UTF-8/en_IE.UTF-8/C/en_IE.UTF-8/en_IE.UTF-8

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

other attached packages:
[1] ggplot2_3.1.0   quanteda_1.3.17

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0         pillar_1.3.0       compiler_3.5.0    
 [4] plyr_1.8.4         bindr_0.1.1        base64enc_0.1-3   
 [7] tools_3.5.0        stopwords_0.9.0    digest_0.6.18     
[10] debugme_1.1.0      evaluate_0.12      lubridate_1.7.4   
[13] tibble_1.4.2       gtable_0.2.0       lattice_0.20-38   
[16] pkgconfig_2.0.2    rlang_0.3.0.1      reprex_0.2.1      
[19] Matrix_1.2-15      fastmatch_1.1-0    rstudioapi_0.8    
[22] yaml_2.2.0         bindrcpp_0.2.2     knitr_1.20        
[25] withr_2.1.2        dplyr_0.7.8        stringr_1.3.1     
[28] fs_1.2.6           rprojroot_1.3-2    grid_3.5.0        
[31] tidyselect_0.2.5   glue_1.3.0         data.table_1.11.8 
[34] R6_2.3.0           processx_3.2.0     rmarkdown_1.10    
[37] clipr_0.4.1        callr_3.0.0        whisker_0.3-2     
[40] purrr_0.2.5        reshape2_1.4.3     spacyr_0.9.91     
[43] magrittr_1.5       ps_1.2.1           backports_1.1.2   
[46] htmltools_0.3.6    scales_1.0.0       assertthat_0.2.0  
[49] colorspace_1.3-2   labeling_0.3       stringi_1.2.4     
[52] lazyeval_0.2.1     RcppParallel_4.4.1 munsell_0.5.0     
[55] crayon_1.3.4 

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions