BradyAJohnston / plasmapR

Creating plasmid maps inside ggplot.
https://bradyajohnston.github.io/plasmapR/
Other
79 stars 8 forks source link

Turn off polar coordinates #7

Closed stephenturner closed 1 year ago

stephenturner commented 1 year ago

I'd like to use this to draw cloning vector constructs. When I run the example and attempt to scale back to cartesian coordinates, I get an error that the ftt object isn't found.

library(plasmapR)
library(ggplot2)
fl <- system.file('extdata', 'petm20.gb', package = "plasmapR")

plasmid <- fl |> read_gb()

dat <- plasmid |> as.data.frame()

dat[dat$type == "CDS", ] |> 
  plot_plasmid(name = "pETM-20") + 
  coord_cartesian()
Error in makeContent.fittexttree(x) : object 'ftt' not found
> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] ggplot2_3.4.2  plasmapR_0.2.1

loaded via a namespace (and not attached):
 [1] ggrepel_0.9.3      Rcpp_1.0.10        prettyunits_1.1.1  ps_1.7.4           rprojroot_2.0.3    digest_0.6.31     
 [7] utf8_1.2.3         mime_0.12          R6_2.5.1           evaluate_0.20      pillar_1.9.0       rlang_1.1.0       
[13] curl_5.0.0         rstudioapi_0.14    miniUI_0.1.1.1     callr_3.7.3        urlchecker_1.0.1   rmarkdown_2.21    
[19] labeling_0.4.2     desc_1.4.2         devtools_2.4.5     readr_2.1.4        stringr_1.5.0      htmlwidgets_1.6.2 
[25] munsell_0.5.0      bit_4.0.5          shiny_1.7.4        compiler_4.2.3     httpuv_1.6.9       xfun_0.38         
[31] pkgconfig_2.0.3    pkgbuild_1.4.0     htmltools_0.5.5    tidyselect_1.2.0   tibble_3.2.1       fansi_1.0.4       
[37] dplyr_1.1.1        crayon_1.5.2       tzdb_0.3.0         withr_2.5.0        later_1.3.0        grid_4.2.3        
[43] xtable_1.8-4       gtable_0.3.3       lifecycle_1.0.3    magrittr_2.0.3     scales_1.2.1       cli_3.6.1         
[49] stringi_1.7.12     vroom_1.6.1        cachem_1.0.7       farver_2.1.1       fs_1.6.1           promises_1.2.0.1  
[55] remotes_2.4.2      generics_0.1.3     ellipsis_0.3.2     vctrs_0.6.1        RColorBrewer_1.1-3 tools_4.2.3       
[61] bit64_4.0.5        glue_1.6.2         purrr_1.0.1        hms_1.1.3          processx_3.8.0     pkgload_1.3.2     
[67] parallel_4.2.3     fastmap_1.1.1      yaml_2.3.7         colorspace_2.1-0   sessioninfo_1.2.2  memoise_2.0.1     
[73] knitr_1.42         profvis_0.3.7      usethis_2.1.6     
BradyAJohnston commented 1 year ago

I've just pushed a fix to main that solves this issue, so if you reinstall the package it will hopefully work!

I was previously using some copied & pasted code from ggfittext while I was waiting for an update for the package to be officially release so I have since updated it to use that package which solves the issue.

I don't know how well it will display going to cartesian coordinates. I hadn't originally planned for this display, but happy to help support this kind of display if you have requests.

stephenturner commented 1 year ago

Thanks for the quick fix. Honestly this does much of what I'd like to do. Between this and David's gggenes I think I have what I need!

library(plasmapR)

fl <- system.file('extdata', 'petm20.gb', package = "plasmapR")

fl |> 
  read_gb() |> 
  plot_plasmid(name = "pETM-20") + 
  ggplot2::coord_cartesian()

image