Giter VIP home page Giter VIP logo

rphylopic's Introduction

palaeoverse

R-CMD-check codecov CRAN status CRAN downloads Twitter URL

palaeoverse is an R package developed by palaeobiologists, for palaeobiologists.

The aim of palaeoverse is to generate a community-driven software package of generic functions for the palaeobiological community. The package does not provide implementations of statistical analyses, rather it provides auxiliary functions to help streamline analyses and improve code readability and reproducibility.

Development team

Installation

The stable version of palaeoverse can be installed from CRAN using:

install.packages("palaeoverse")

The development version of palaeoverse can be installed via GitHub using:

# install.packages("devtools")
devtools::install_github("palaeoverse/palaeoverse")

How to contribute?

If you are interested in contributing to the palaeoverse R package, you can do so by following these guidelines. We have also adopted a set of standards and structure to follow for contributing to the project. If you would like to contribute to palaeoverse, we strongly advise reading this document.

Code of Conduct

As with any community project, society, or meeting we feel it is important to established some expectations of behaviour in the palaeoverse community. Please read our code of conduct, and reach out if you ever face any issues. Everyone has the right to live and work in a harassment-free environment.

Citation

If you use the palaeoverse R package in your work, please cite as:

Jones, L.A., Gearty, W., Allen, B.J., Eichenseer, K., Dean, C.D., Galván S., Kouvari, M., Godoy, P.L., Nicholl, C., Dillon, E.M., Flannery-Sutherland, J.T., Chiarenza, A.A. 2023. palaeoverse: A community-driven R package to support palaeobiological analysis. Methods in Ecology and Evolution. doi: 10.1111/2041-210X.14099.

Hexlogo by Miranta Kouvari and Cecily Nicholl

rphylopic's People

Contributors

bschilder avatar gabspalomo avatar lewisajones avatar rdinnager avatar sckott avatar timelyportfolio avatar willgearty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rphylopic's Issues

Batch viewing for pick_phylopic

For some searches, there may be many results for pick_phylopic() (e.g., "Cat" or "Animal"). I think the user should be able to specify how many phylopics they want to see at once to speed up the process of picking. The menu would then need to have that many options (plus an option to go to the next batch).

get_attribution

Currently, attribution data is available via get_attribution. It could be useful to provide a token output which could be included in manuscripts/text, for example:

"Organism silhouette from PhyloPic (Michael Keesey, 2023), created by John Smith (2023)."

Better error handling when specified raster size doesn't exist

Describe the bug
get_phylopic gives an error about the URL length for certain species.

To Reproduce

s <- "mus musculus"
URL <- rphylopic::get_uuid(name = s,
                                       url = TRUE)  
png_data <- rphylopic::get_phylopic(uuid = names(URL),
                                                    format = "512")
Error in parse_url(url) : length(url) == 1 is not TRUE
12.
stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
11.
stopifnot(length(url) == 1)
10.
parse_url(url)
9.
is.url(url)
8.
stopifnot(is.url(url))
7.
build_url(parse_url(url)[c("scheme", "hostname", "port")])
6.
handle_name(url)
5.
handle_find(url)
4.
handle_url(handle, url, ...)
3.
GET(url = x)
2.
get_png(url)
1.
rphylopic::get_phylopic(uuid = names(URL), format = "512")

Expected behavior

If more than 1 URL is available, the function will automatically pick the first one.

If none are available, an error message will tell the user this.

Desktop (please complete the following information):

  • OS: macOS Ventura 13.2.1
  • rphylopic version: 1.0.0
  • R Version: 4.2.1 (2022-06-23)

Session info

``` R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/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] shiny_1.7.4 orthogene_1.5.1 rphylopic_1.0.0 ggplot2_3.4.1 ggtree_3.6.2

loaded via a namespace (and not attached):
[1] utf8_1.2.3 gptstudio_0.1.0 devoptera_0.99.0 R.utils_2.12.2
[5] RUnit_0.4.32 tidyselect_1.2.0 RSQLite_2.3.0 AnnotationDbi_1.60.2
[9] htmlwidgets_1.6.2 grid_4.2.1 combinat_0.0-8 chatgpt_0.2.2
[13] devtools_2.4.5 munsell_0.5.0 codetools_0.2-19 ragg_1.2.5
[17] miniUI_0.1.1.1 withr_2.5.0 colorspace_2.1-0 Biobase_2.58.0
[21] TreeTools_1.9.1 knitr_1.42 rstudioapi_0.14 stats4_4.2.1
[25] ggsignif_0.6.4 MatrixGenerics_1.10.0 Rdpack_2.4 labeling_0.4.2
[29] GenomeInfoDbData_1.2.9 mnormt_2.1.1 optimParallel_1.0-2 topGO_2.50.0
[33] bit64_4.0.5 farver_2.1.1 rprojroot_2.0.3 coda_0.19-4
[37] vctrs_0.6.1 treeio_1.23.1 generics_0.1.3 clusterGeneration_1.3.7
[41] xfun_0.37 R6_2.5.1 doParallel_1.0.17 GenomeInfoDb_1.34.9
[45] rsvg_2.4.0 grImport2_0.2-0 bitops_1.0-7 cachem_1.0.7
[49] gridGraphics_0.5-1 DelayedArray_0.24.0 assertthat_0.2.1 promises_1.2.0.1
[53] scales_1.2.1 gtable_0.3.3 biocViews_1.66.3 processx_3.8.0
[57] phangorn_2.11.1 rlang_1.1.0 systemfonts_1.0.4 scatterplot3d_0.3-43
[61] rstatix_0.7.2 lazyeval_0.2.2 broom_1.0.4 BiocManager_1.30.20
[65] yaml_2.3.7 abind_1.4-5 ggimage_0.3.1.002 backports_1.4.1
[69] httpuv_1.6.9 RBGL_1.74.0 tools_4.2.1 usethis_2.1.6
[73] ggplotify_0.1.0 ellipsis_0.3.2 jquerylib_0.1.4 RColorBrewer_1.1-3
[77] BiocGenerics_0.44.0 sessioninfo_1.2.2 Rcpp_1.0.10 plyr_1.8.8
[81] base64enc_0.1-3 zlibbioc_1.44.0 purrr_1.0.1 RCurl_1.98-1.10
[85] ps_1.7.3 prettyunits_1.1.1 ggpubr_0.6.0 urlchecker_1.0.1
[89] fontawesome_0.5.0 S4Vectors_0.36.2 grr_0.9.5 fs_1.6.1
[93] here_1.0.1 magrittr_2.0.3 data.table_1.14.8 magick_2.7.4
[97] SparseM_1.81 R.cache_0.16.0 matrixStats_0.63.0 pkgload_1.3.2
[101] patchwork_1.1.2 mime_0.12 evaluate_0.20 xtable_1.8-4
[105] XML_3.99-0.14 jpeg_0.1-10 IRanges_2.32.0 compiler_4.2.1
[109] tibble_3.2.1 maps_3.4.1 crayon_1.5.2 R.oo_1.25.0
[113] htmltools_0.5.4 ggfun_0.0.9 later_1.3.0 tidyr_1.3.0
[117] aplot_0.1.10 expm_0.999-7 DBI_1.1.3 gprofiler2_0.2.1
[121] MASS_7.3-58.3 babelgene_22.9 Matrix_1.5-3 car_3.1-1
[125] piggyback_0.1.4 cli_3.6.1 quadprog_1.5-8 R.methodsS3_1.8.2
[129] rbibutils_2.2.13 parallel_4.2.1 igraph_1.4.1 GenomicRanges_1.50.2
[133] pkgconfig_2.0.3 numDeriv_2016.8-1.1 plotly_4.10.1 foreach_1.5.2
[137] bslib_0.4.2 stringdist_0.9.10 XVector_0.38.0 BiocCheck_1.34.3
[141] yulab.utils_0.0.6 stringr_1.5.0 callr_3.7.3 digest_0.6.31
[145] phytools_1.5-1 graph_1.76.0 Biostrings_2.66.0 rmarkdown_2.20.1
[149] fastmatch_1.1-3 tidytree_0.4.2 curl_5.0.0 lifecycle_1.0.3
[153] nlme_3.1-162 jsonlite_1.8.4 carData_3.0-5 OmaDB_2.14.0
[157] desc_1.4.2 viridisLite_0.4.1 fansi_1.0.4 pillar_1.9.0
[161] lattice_0.20-45 homologene_1.4.68.19.3.27 KEGGREST_1.38.0 fastmap_1.1.1
[165] httr_1.4.5 plotrix_3.8-2 pkgbuild_1.4.0 GO.db_3.16.0
[169] glue_1.6.2 remotes_2.4.2 png_0.1-8 iterators_1.0.14
[173] bit_4.0.5 sass_0.4.5 stringi_1.7.12 profvis_0.3.7
[177] blob_1.2.4 textshaping_0.3.6 memoise_2.0.1 dplyr_1.1.1
[181] ape_5.7-1

</details>

Pull Phylogeny from PhyloPic

Re this: "I plan to be able to get a phylogeny for taxa associatd with Phylopic silhouettes using the NCBI taxonomy, but it's not easily available yet"

You could pull the phylogeny from PhyloPic itself. Granted, it's not as clean overall as NCBI, but it is usually at least as good for illustrated taxa (sometimes better).

Here's the relevant method: http://phylopic.org/api/#method-name-taxonomy

Should we temporarily cache svg files?

Right now we store a single "temp.svg" file in the temporary directory. This is a part of the svg conversion process with rsvg. However, the ggplot production process often involves several iterations of tweaking plots before saving them, so perhaps it would make sense to store all of the svg files as <uuid>.svg in the temporary directory. Then, when we go to download a phylopic, we first check whether it is in the temporary directory first, instead of downloading and converting all over again. This should generally result in notable speed ups, especially when lots of the same phylopics are being used over and over. The temporary folder is cleared whenever R is closed, so this shouldn't result in any permanent storage usage.

Error loading image data

─ Session info setting value version R version 4.2.1 (2022-06-23) os macOS Monterey 12.6.2 system x86_64, darwin17.0 ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz America/New_York date 2023-02-24 rstudio 2022.12.0+353 Elsbeth Geranium (desktop) pandoc NA

I recently used rphylopic to add images to ggplot figures for a publication, I want to make some changes to these figures for my dissertation but the code I used to save the image data for the phylopic silhouettes is giving me an error. This code worked before and I checked that the phylopic image I am referencing still exists. An example below

library(rphylopic)
lynx_phylo <- image_data("0957f561-d68e-499b-b1ad-20f444064033", size = 256)[[1]]

The error returned is:
Error in png::readPNG(res$content) : libpng error: Not a PNG file

I found a similar issue online [libpng errors #22] but the solution code did not work for me, example below.

id <- '0957f561-d68e-499b-b1ad-20f444064033'
z <- name_images(uuid = id)

Which returned this error:
Error: Not Found (HTTP 404)

Any assistance resolving this would be greatly appreciated.

Emulate PhyloPic silhouette search

Currently, we have a simplified approach to accessing PhyloPic silhouettes from the API by using the images route and filter_name. This does not seem to return the same silhouettes for a given search as it would if you searched the PhyloPic website. This should be looked into to understand where these differences are coming from and whether we should be using the nodes route to access silhouettes.

Make add_phylopic work with facets

Hi,

thanks for the great package, I would be interested in making add_phylopic work with ggplot2 facets. The goal would be to be able to put different images in each facets in the following example:

library(ggplot2)
library(rphylopic)

img <- image_data("27356f15-3cf8-47e8-ab41-71c6260b2724", size = "512")[[1]]

ggplot(mpg, aes(displ, hwy)) + 
  geom_point() +
  facet_wrap(~ class) +
  add_phylopic(img)

Created on 2019-10-28 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Ubuntu 16.04.6 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_US                       
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Paris                
#>  date     2019-10-28                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
#>  backports     1.1.5   2019-10-02 [1] CRAN (R 3.6.1)
#>  callr         3.3.2   2019-09-22 [1] CRAN (R 3.6.1)
#>  cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
#>  colorspace    1.4-1   2019-03-18 [1] CRAN (R 3.6.0)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
#>  crul          0.8.4   2019-08-02 [1] CRAN (R 3.6.1)
#>  curl          4.2     2019-09-24 [1] CRAN (R 3.6.1)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
#>  devtools      2.2.1   2019-09-24 [1] CRAN (R 3.6.1)
#>  digest        0.6.21  2019-09-20 [1] CRAN (R 3.6.1)
#>  dplyr         0.8.3   2019-07-04 [1] CRAN (R 3.6.1)
#>  ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.1)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.0)
#>  fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
#>  ggplot2     * 3.2.1   2019-08-10 [1] CRAN (R 3.6.1)
#>  glue          1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
#>  gridBase      0.4-7   2014-02-24 [1] CRAN (R 3.6.1)
#>  gtable        0.3.0   2019-03-25 [1] CRAN (R 3.6.0)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.6.0)
#>  htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.6.0)
#>  httpcode      0.2.0   2016-11-14 [1] CRAN (R 3.6.0)
#>  httr          1.4.1   2019-08-05 [1] CRAN (R 3.6.1)
#>  jsonlite      1.6     2018-12-07 [1] CRAN (R 3.6.0)
#>  knitr         1.25    2019-09-18 [1] CRAN (R 3.6.1)
#>  labeling      0.3     2014-08-23 [1] CRAN (R 3.6.0)
#>  lazyeval      0.2.2   2019-03-15 [1] CRAN (R 3.6.0)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
#>  mime          0.7     2019-06-11 [1] CRAN (R 3.6.0)
#>  munsell       0.5.0   2018-06-12 [1] CRAN (R 3.6.0)
#>  pillar        1.4.2   2019-06-29 [1] CRAN (R 3.6.1)
#>  pkgbuild      1.0.5   2019-08-26 [1] CRAN (R 3.6.1)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 3.6.1)
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
#>  png           0.1-7   2013-12-03 [1] CRAN (R 3.6.0)
#>  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
#>  processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.1)
#>  ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
#>  purrr         0.3.2   2019-03-15 [1] CRAN (R 3.6.0)
#>  R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
#>  Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.1)
#>  remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.0)
#>  rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.0)
#>  rmarkdown     1.16    2019-10-01 [1] CRAN (R 3.6.1)
#>  rphylopic   * 0.2.0   2018-11-19 [1] CRAN (R 3.6.1)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
#>  scales        1.0.0   2018-08-09 [1] CRAN (R 3.6.0)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
#>  stringi       1.4.3   2019-03-12 [1] CRAN (R 3.6.0)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.0)
#>  testthat      2.2.1   2019-07-25 [1] CRAN (R 3.6.1)
#>  tibble        2.1.3   2019-06-06 [1] CRAN (R 3.6.0)
#>  tidyselect    0.2.5   2018-10-11 [1] CRAN (R 3.6.0)
#>  triebeard     0.3.0   2016-08-04 [1] CRAN (R 3.6.0)
#>  urltools      1.7.3   2019-04-14 [1] CRAN (R 3.6.0)
#>  usethis       1.5.1   2019-07-04 [1] CRAN (R 3.6.1)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
#>  xfun          0.10    2019-10-01 [1] CRAN (R 3.6.1)
#>  xml2          1.2.2   2019-08-09 [1] CRAN (R 3.6.1)
#>  yaml          2.2.0   2018-07-25 [1] CRAN (R 3.6.0)
#> 
#> [1] /home/hugo/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

libpng errors

Hi! I am looking for a couple images to include in ggplot2 plots, and am getting libpng errors when I call image_data(). I'm guessing these are just listed image files that aren't available in PNG format but it would be cool to know (via error message, perhaps?) what to do next. Here is an example:

library(rphylopic)
harborseal <- name_search(text = "Phoca vitulina", options = "namebankID")[[1]] 
id <- harborseal$uid[1]
img <- image_data(id, size = "64")[[1]]

The error returned by the final line is this:
Error in png::readPNG(res$content) : libpng error: Not a PNG file

Two questions:

  1. If uids without PNG files are included in search results from name_search(), is there a way to flag the ones that don't have PNG files available?
    and
  2. If this is an error on my part, can you help me figure out how to find ones that have png files?

As a side note, it would also be cool to have a display option, like RColorBrewer::display.brewer.pal() but for the set of images available for a taxon. If you don't have this already, I would be happy to contribute this code once I understand the package a little better...

Session Info
- Session info ---------------------------------------------------------------------------------------------------------
 R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

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.6/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
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] rphylopic_0.2.0    scales_1.0.0       gridExtra_2.3      RColorBrewer_1.1-2 RCurl_1.95-4.12   
 [6] bitops_1.0-6       beyonce_0.1        mvcwt_1.3.1        biwavelet_0.20.17  DescTools_0.99.28 
[11] fractal_2.0-4      ifultools_2.0-5    splus2R_1.2-2      taxize_0.9.8       forcats_0.4.0     
[16] stringr_1.4.0      dplyr_0.8.3        purrr_0.3.2        readr_1.3.1        tidyr_0.8.3       
[21] tibble_2.1.3       ggplot2_3.2.0      tidyverse_1.2.1    reshape2_1.4.3    

loaded via a namespace (and not attached):
 [1] httr_1.4.0           maps_3.3.0           jsonlite_1.6         foreach_1.4.4        bold_0.9.0          
 [6] here_0.1             dotCall64_1.0-0      modelr_0.1.4         assertthat_0.2.1     expm_0.999-4        
[11] cellranger_1.1.0     yaml_2.2.0           pillar_1.4.2         backports_1.1.4      lattice_0.20-38     
[16] glue_1.3.1           digest_0.6.20        sapa_2.0-2           rvest_0.3.4          colorspace_1.4-1    
[21] Matrix_1.2-17        plyr_1.8.4           pkgconfig_2.0.2      httpcode_0.2.0       broom_0.5.2         
[26] haven_2.1.1          mvtnorm_1.0-11       manipulate_1.0.1     generics_0.0.2       withr_2.1.2         
[31] lazyeval_0.2.2       cli_1.1.0            magrittr_1.5         crayon_1.3.4         readxl_1.3.1        
[36] nlme_3.1-140         MASS_7.3-51.4        xml2_1.2.0           foreign_0.8-71       tools_3.6.1         
[41] data.table_1.12.2    hms_0.5.0            gridBase_0.4-7       munsell_0.5.0        wmtsa_2.0-3         
[46] compiler_3.6.1       rlang_0.4.0          grid_3.6.1           iterators_1.0.10     rstudioapi_0.10     
[51] spam_2.2-2           labeling_0.3         boot_1.3-22          gtable_0.3.0         codetools_0.2-16    
[56] reshape_0.8.8        curl_3.3             R6_2.4.0             zoo_1.8-6            lubridate_1.7.4     
[61] zeallot_0.1.0        rprojroot_1.3-2      ape_5.3              stringi_1.4.3        parallel_3.6.1      
[66] crul_0.8.4           Rcpp_1.0.1           png_0.1-7            fields_9.8-3         vctrs_0.2.0         
[71] scatterplot3d_0.3-41 tidyselect_0.2.5                

base graphics

Add fxn like add_phylopic(), but for base graphics

verbose geom_phylopic

Add an argument (verbose, maybe?) to geom_phylopic that spits out the attribution information for the silhouettes (mostly useful when name = is used. Perhaps there should also be a warning when name = is used and verbose = FALSE?

distorted aspect ratio in figures with very different x/y axes acaling

Hi there, thanks for rphylopic! I have problem between versions 0.2.0 and 0.3.0. It seems to me that the versions are not backwards compatible. Version 0.2 was accepting relative x/y coordinates, while the 0.3 takes absolute (at least for the add_phylopic_base function). In the version 0.3.0 the scaling is distorted. It seems to me that it holds the ratio of axis, which is really problematic for plots with very different x/y.

In the v0.2.0 everything works fine regardless of axis scaling

library('rphylopic')
Ocin_silh <- image_data("db8f0cd7-3780-4ddc-97a5-1f358c40c734", size = 128)[[1]]
Afus_silh <- image_data("af19a15c-9cbd-485d-ad7f-4f2691a19d95", size = 128)[[1]]

pdf('issue_28_ok_figure.pdf', width = 10, height = 6)
  par(mfrow = c(1, 2), oma = c(0, 0, 2, 0))
  plot(as.numeric(NULL), xlim = c(0, 1), ylim = c(0, 500))
  add_phylopic_base(Ocin_silh, x = 0.2, y = 0.9, ysize = 0.3, alpha = 1)

  plot(as.numeric(NULL), xlim = c(0, 300), ylim = c(0, 700))
  add_phylopic_base(Afus_silh, x = 0.15, y = 0.93, ysize = 0.23, alpha = 1)
dev.off()

Screenshot 2020-07-15 at 13 04 30

The v0.3.0 seems to have a problem when x/y axes are very different (panel a). The problem is not apparent for cases when the axes have a similar scale (panel b).

library('rphylopic')
Ocin_silh <- image_data("db8f0cd7-3780-4ddc-97a5-1f358c40c734", size = 128)[[1]]
Afus_silh <- image_data("af19a15c-9cbd-485d-ad7f-4f2691a19d95", size = 128)[[1]]

pdf('issue_28_not_so_great_figure.pdf', width = 10, height = 6)
  par(mfrow = c(1, 2), oma = c(0, 0, 2, 0))
  plot(as.numeric(NULL), xlim = c(0, 1), ylim = c(0, 700))
  add_phylopic_base(Ocin_silh, x = 0.2, y = 0.9 * 700, ysize = 0.3 * 700, alpha = 1)

  plot(as.numeric(NULL), xlim = c(0, 300), ylim = c(0, 700))
  add_phylopic_base(Afus_silh, x = 0.15 * 300, y = 0.93 * 700, ysize = 0.23 * 700, alpha = 1)
dev.off()

Screenshot 2020-07-15 at 13 04 39

Session Info of the alright plot
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.4

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] C

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

other attached packages:
[1] rphylopic_0.2.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1       png_0.1-7        assertthat_0.2.1 dplyr_0.8.1     
 [5] crayon_1.3.4     gridBase_0.4-7   grid_3.5.2       crul_0.9.0      
 [9] R6_2.4.0         jsonlite_1.6     gtable_0.3.0     magrittr_1.5    
[13] scales_1.0.0     ggplot2_3.2.0    pillar_1.4.1     rlang_0.4.5     
[17] curl_3.3         lazyeval_0.2.2   glue_1.3.1       purrr_0.3.2     
[21] munsell_0.5.0    compiler_3.5.2   pkgconfig_2.0.2  colorspace_1.4-1
[25] tidyselect_0.2.5 tibble_2.1.3     httpcode_0.3.0  
Session Info of the distorted plot
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin19.5.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS/LAPACK: /usr/local/Cellar/openblas/0.3.10_1/lib/libopenblasp-r0.3.10.dylib

locale:
[1] C

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

other attached packages:
[1] rphylopic_0.3.0

loaded via a namespace (and not attached):
 [1] png_0.1-7        crayon_1.3.4     gridBase_0.4-7   grid_4.0.2      
 [5] crul_0.9.0       R6_2.4.1         jsonlite_1.7.0   lifecycle_0.2.0 
 [9] gtable_0.3.0     magrittr_1.5     scales_1.1.1     pillar_1.4.6    
[13] ggplot2_3.3.2    rlang_0.4.7      curl_4.3         vctrs_0.3.1     
[17] ellipsis_0.3.1   glue_1.4.1       munsell_0.5.0    compiler_4.0.2  
[21] pkgconfig_2.0.3  colorspace_1.4-1 tibble_3.0.3     httpcode_0.3.0 

Preview option for get_phylopic

We should add an argument (preview?) to get_phylopic() that allows the user to preview the silhouette when it is downloaded

Package 'rphylopic' is not available (for R version 3.4.3)

Using RStudio 1.1.383 on MacOS High Sierra 10.13.2, it appears rphylopic isn't available for R version 3.4.3.

In a fresh instance of RStudio:

> install.packages("rphylopic")
Warning in install.packages :
  package ‘rphylopic’ is not available (for R version 3.4.3)

Session info:

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.2

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.4/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     

loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3    yaml_2.1.16   

Cheatsheet

The cheatsheet is currently only available via the palaeoverse website. We should either:

  • Include the cheatsheet directly into the package
  • Add a link the pkgdown website
  • Add to README
  • Or all three....

Use rsvg to generate pngs from vector files

Sometimes there isn't a png of the desired size available on phylopic (e.g., #46). We now catch this and throw and warning and fall back to the largest available png (#47), but sometimes only a very small png is available, which might not be desirable. Now, as we've discussed, we don't really want to encourage the use of pngs, but it should be fairly straightforward to just generate the pngs ourself from phylopic's vector.svg image using rsvg_png and readPNG. This way users could theoretically specify any desired png size and we would be able to make it for them (although perhaps we could still download the existing png if it exists for the desired size to be faster).

Image background colour

save_phylopic uses grDevices to save images. By default, grDevices sets the background of the image to white. This should probably be updated to be transparent by default otherwise users might encounter issues. This might need to be format dependent (i.e. this will work well for png and svgs but it is worth checking handling for jpgs, etc).

color outlines with recolor_phylopic

This wouldn't work with png objects (but eww anyways), but it should be pretty easy to allow for silhouette fills to be different from colors (outline color).

One concern is that if we switch the argument from color to fill, this could affect existing code. Maybe if only one of these is specified, it always changes both colors, but if both arguments/aesthetics are specified, then the fill and color would be different?

Release rphylopic 1.1.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

plot_phylopic_base doesn't produce a plot

Session Info
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] rphylopic_0.2.1.91 vcr_0.5.4          testthat_2.3.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6      compiler_4.0.0    pillar_1.4.4      base64enc_0.1-3
 [5] prettyunits_1.1.1 remotes_2.1.1     tools_4.0.0       digest_0.6.25
 [9] pkgbuild_1.0.8    pkgload_1.0.2     gridBase_0.4-7    jsonlite_1.6.1
[13] memoise_1.1.0     lifecycle_0.2.0   tibble_3.0.1      gtable_0.3.0
[17] png_0.1-7         pkgconfig_2.0.3   rlang_0.4.6       cli_2.0.2
[21] rstudioapi_0.11   yaml_2.2.1        curl_4.3          crul_0.9.0
[25] httr_1.4.1        withr_2.2.0       dplyr_0.8.5       fauxpas_0.5.0
[29] desc_1.2.0        fs_1.4.1          vctrs_0.3.0       devtools_2.3.0
[33] triebeard_0.3.0   tidyselect_1.1.0  rprojroot_1.3-2   grid_4.0.0
[37] httpcode_0.3.0    glue_1.4.1        R6_2.4.1          processx_3.4.2
[41] fansi_0.4.1       sessioninfo_1.1.1 whisker_0.4       webmockr_0.6.2
[45] purrr_0.3.4       callr_3.4.3       ggplot2_3.3.0     magrittr_1.5
[49] urltools_1.7.3    backports_1.1.7   scales_1.1.1      ps_1.3.3
[53] ellipsis_0.3.1    usethis_1.6.1     assertthat_0.2.1  colorspace_1.4-1
[57] lazyeval_0.2.2    munsell_0.5.0     crayon_1.3.4.9000

Running:

cat <- image_data("23cd6aa4-9587-4a2e-8e26-de42885004c9", size = 128)[[1]]
plot_phylopic_base(cat)

only produces a blank plot window.

(I can look into this!)

Vectorize add_phylopic and add_phylopic_base

Right now add_phylopic() and add_phylopic_base() can only place a single image in a single location. We should vectorize them so that you can provide multiple locations and/or images in a single call. I was thinking something like how deeptime::axis_geo() handles single values and/or lists? Note, this would be different from the new geom_phylopic() function for #25.

installation not working on Ubuntu 16.04

I get the following when trying to install rphylopic on my linux server:

> devtools::install_github("sckott/rphylopic")
Downloading GitHub repo sckott/rphylopic@master
from URL https://api.github.com/repos/sckott/rphylopic/zipball/master
Installation failed: error in running command
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /ebio/abt3_projects/software/miniconda3/envs/ga_R_install/lib/R/lib/libRblas.so
LAPACK: /ebio/abt3_projects/software/miniconda3/envs/ga_R_install/lib/R/lib/libRlapack.so

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   base

loaded via a namespace (and not attached):
 [1] httr_1.3.1      compiler_3.4.1  R6_2.2.2        tools_3.4.1
 [5] withr_2.1.1     curl_3.1        memoise_1.1.0   git2r_0.21.0
 [9] digest_0.6.13   devtools_1.13.5

However, devtools::install_github("sckott/rphylopic") is working for my OSX R install.

Reimplement `image_list()`

Is your feature request related to a problem? Please describe.
I wrote a package for making packed image mosaics (https://github.com/rdinnager/impac). I use phylopic images as an example on the readme (and automatically generate new images every week). To do this I used rphylopic::image_list() that used to exist as of the last version, but seems to no longer. I use it to get all image uuids available in the database and then randomly select some of them.

Describe the solution you'd like
Reimplement image_list(). Failing this, a function to grab a random image from Phylopic would work for my use case.

Describe alternatives you've considered
Can't think of any right now. I'm happy to implement myself and make a pull request if that would help.

Problem with R ver 4.3

Describe the bug
"Although it was functioning correctly in the past with ggplot2, the most recent update of R (ver 4.3) has resulted in the following error:

"Error in add_phylopic(img = img_Lsceler, color = "black", alpha = 0.7) :
argument "x" is missing, with no default"

To Reproduce
uuid_Lsceler <- get_uuid(name = "Lagocephalus sceleratus", n = 1)
get_attribution(uuid = uuid_Lsceler)
img_Lsceler <- get_phylopic(uuid = uuid_Lsceler)

Lsceler_p1=ggplot() +
add_phylopic(img = img_Lsceler, color = "black", alpha = .7) +
theme_bw()

Desktop (please complete the following information):

  • OS: Windows 10
  • palaeoverse version : 1.1.1
  • R Version : 4.3
  • ggplot2 version : 3.4.2

Readme should avoid always showing uid strings, use friendly variable names instead.

Completely minor thing: I think the readme would read more naturally if you began with a search for a species name, and stored the returned identifier in a semantically meaningful string ("cat", "bug"), to minimize showing the full hashes. e.g.

person <- name_search("Homo sapiens")[1,1]
image_data(person)

might be less intimidating.

Release version: 404 errors

Thanks for the awesome package! I'm the maintainer of orthogene and noticed some issues that started in the past month due to rphylopic (one of orthogene's deps). neurogenomics/orthogene#28

Based on your GH Actions, it seems whatever issues occurred in this version were resolved in current devel version 1.0.0. I see you've been making some recent pushes to the code and was wondering when the updated version might be available on CRAN. I ask because orthogene is on Bioconductor, which can only use packages on CRAN/Bioc. The deadline for making fixes before the next Bioc release is April 5th; after that any packages relying on rphylopic will automatically become deprecated (unless the authors have resolved the errors).

Thanks in advance for your help.

Describe the bug
Using the latest CRAN release version of rphylopic (0.3.0), errors are produced in the name_* examples.

To Reproduce

library(rphylopic)
id <- "1ee65cf3-53db-4a52-9960-a9f7093d845d"
name_get(uuid = id)
Error: Not Found (HTTP 404)
name_search(text = "Homo sapiens")
Error: Not Found (HTTP 404)

Expected behavior

These functions run without errors, and returns the species requested.

Desktop (please complete the following information):

  • OS: macOS Ventura 13.2.1
  • rphylopic version: 0.3.0
  • R Version: 4.2.1

Session info

``` R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/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

loaded via a namespace (and not attached):
[1] utf8_1.2.3 devoptera_0.99.0 R.utils_2.12.2
[4] RUnit_0.4.32 tidyselect_1.2.0 AnnotationDbi_1.60.1
[7] RSQLite_2.3.0 htmlwidgets_1.6.1 grid_4.2.1
[10] combinat_0.0-8 devtools_2.4.5 munsell_0.5.0
[13] codetools_0.2-19 DT_0.27 miniUI_0.1.1.1
[16] withr_2.5.0 colorspace_2.1-0 Biobase_2.58.0
[19] filelock_1.0.2 TreeTools_1.9.0 knitr_1.42
[22] rstudioapi_0.14 orthogene_1.4.1 stats4_4.2.1
[25] ggsignif_0.6.4 MatrixGenerics_1.10.0 Rdpack_2.4
[28] urltools_1.7.3 GenomeInfoDbData_1.2.9 mnormt_2.1.1
[31] optimParallel_1.0-2 topGO_2.50.0 bit64_4.0.5
[34] rprojroot_2.0.3 coda_0.19-4 vctrs_0.5.2
[37] treeio_1.22.0 generics_0.1.3 clusterGeneration_1.3.7
[40] xfun_0.37 BiocFileCache_2.6.1 GenomeInfoDb_1.34.9
[43] R6_2.5.1 doParallel_1.0.17 bitops_1.0-7
[46] cachem_1.0.7 gridGraphics_0.5-1 DelayedArray_0.24.0
[49] promises_1.2.0.1 scales_1.2.1 gtable_0.3.1
[52] biocViews_1.66.3 processx_3.8.0 phangorn_2.11.1
[55] rlang_1.0.6 scatterplot3d_0.3-42 rstatix_0.7.2
[58] lazyeval_0.2.2 broom_1.0.4 BiocManager_1.30.20
[61] yaml_2.3.7 abind_1.4-5 backports_1.4.1
[64] httpuv_1.6.9 rsconnect_0.8.29 RBGL_1.74.0
[67] tools_4.2.1 usethis_2.1.6 ggplotify_0.1.0
[70] gridBase_0.4-7 ggplot2_3.4.1 ellipsis_0.3.2
[73] RColorBrewer_1.1-3 BiocGenerics_0.44.0 sessioninfo_1.2.2
[76] plyr_1.8.8 Rcpp_1.0.10 zlibbioc_1.44.0
[79] purrr_1.0.1 RCurl_1.98-1.10 prettyunits_1.1.1
[82] ps_1.7.2 ggpubr_0.6.0 urlchecker_1.0.1
[85] S4Vectors_0.36.2 grr_0.9.5 fs_1.6.1
[88] here_1.0.1 crul_1.3 magrittr_2.0.3
[91] data.table_1.14.8 SparseM_1.81 triebeard_0.4.1
[94] gh_1.4.0 whisker_0.4.1 R.cache_0.16.0
[97] matrixStats_0.63.0 pkgload_1.3.2 xtable_1.8-4
[100] mime_0.12 hms_1.1.2 patchwork_1.1.2
[103] evaluate_0.20 rworkflows_0.99.8 XML_3.99-0.13
[106] IRanges_2.32.0 compiler_4.2.1 tibble_3.2.0
[109] maps_3.4.1 crayon_1.5.2 R.oo_1.25.0
[112] htmltools_0.5.4 ggfun_0.0.9 later_1.3.0
[115] tzdb_0.3.0 tidyr_1.3.0 aplot_0.1.10
[118] expm_0.999-7 DBI_1.1.3 gprofiler2_0.2.1
[121] dbplyr_2.3.1 MASS_7.3-58.3 rappdirs_0.3.3
[124] babelgene_22.9 dlstats_0.1.6 Matrix_1.5-3
[127] badger_0.2.3 car_3.1-1 readr_2.1.4
[130] piggyback_0.1.4 cli_3.6.0 quadprog_1.5-8
[133] R.methodsS3_1.8.2 rbibutils_2.2.13 parallel_4.2.1
[136] igraph_1.4.1 GenomicRanges_1.50.2 pkgconfig_2.0.3
[139] rvcheck_0.2.1 numDeriv_2016.8-1.1 plotly_4.10.1
[142] xml2_1.3.3 foreach_1.5.2 ggtree_3.6.2
[145] XVector_0.38.0 stringdist_0.9.10 rvest_1.0.3
[148] BiocCheck_1.34.3 yulab.utils_0.0.6 callr_3.7.3
[151] stringr_1.5.0 digest_0.6.31 phytools_1.5-1
[154] graph_1.76.0 Biostrings_2.66.0 httpcode_0.3.0
[157] rmarkdown_2.20.1 fastmatch_1.1-3 tidytree_0.4.2
[160] fauxpas_0.5.0 BiocPkgTools_1.16.1 curl_5.0.0
[163] shiny_1.7.4 lifecycle_1.0.3 nlme_3.1-162
[166] jsonlite_1.8.4 carData_3.0-5 OmaDB_2.14.0
[169] desc_1.4.2 viridisLite_0.4.1 fansi_1.0.4
[172] pillar_1.8.1 lattice_0.20-45 homologene_1.4.68.19.3.27
[175] GO.db_3.16.0 KEGGREST_1.38.0 pkgbuild_1.4.0
[178] fastmap_1.1.1 httr_1.4.5 plotrix_3.8-2
[181] remotes_2.4.2 glue_1.6.2 png_0.1-8
[184] iterators_1.0.14 bit_4.0.5 profvis_0.3.7
[187] stringi_1.7.12 blob_1.2.3 rphylopic_0.3.0
[190] memoise_2.0.1 renv_0.17.0 dplyr_1.1.0
[193] rorcid_0.7.0 ape_5.7

</details>

Place image in specified place on plot

Would love to be able to place the image anywhere on the ggplot plot, not just as a background. Seems like this would just require using xmin, ymin, xmax, and ymax in annotation_custom(). I could add this in if you are busy. I enjoy the package. Thanks for making it!

Help wanted moving to new Phylopic API

see issue #23

Anyone that's contributed to this package or using it want to help move to the new API? Seems there's a bit of a time crunch, and I don't really have time right now.

❤️

rphylopic not working with ggdraw in cowplot

Really love this package and so happy to see it up and working again! rphylopic used to work with ggdraw in cowplot but the latest version doesn't seem to be working. I'm hoping I'm just missing something in the new version.

library(ggplot2)
Plot <- ggplot(iris) + geom_point(aes(x = Sepal.Length, y = Sepal.Width))

library(rphylopic)
Bird   <- get_phylopic("51ee5cb2-e7fe-48f5-939a-2aad427919ec", format = "512")

library(cowplot)
ggdraw() +
  draw_plot(Plot, x = 0, y = 0, width = 1, height = 1)+
  add_phylopic_base(img = Bird, x = 0.500, y = 0.95, ysize = 0.09, color = "blue", alpha = .9)# this used to work

Stand Alone png

Great work Scott

Is it possible to create a png of the silhouette?

get_uuid still doesn't replicate phylopic.org search

The goal for get_uuid is to make it behave just like the search bar on phylopic.org. However, it appears that we are still missing something, because some search terms give errors with get_uuid whereas they give reasonable results on phylopic.org. It looks like this might be related to phylopic's use of external databases, which maybe we could emulate using some of the phylopic API endpoints? Or maybe we should reach out to Mike and see if the search endpoint could better emulate the frontend search functionality?

Here's an example that works on phylopic.org but not with get_uuid: Myotis lucifugus

list_images issues

list_images(start=1, length=10)
Error: could not find function "list_images"

also the help page has heading
"Input an image and create a ggplot2 layer to add to an existing plot"
same as add_phylopic

Vignette

Currently we have a few usage examples within our README.md. We should probably prepare a vignette which pulls this together. This would be beneficial for the following reasons:

  • We will know if the examples need updating when there are changes to the package
  • The examples are ported with the package
  • The vignettes will be readily available via the pkgdown site

I suggest this should be done for v.1.1.0.

add_phylopic_base Fails with Complex layout()

Hey Scott,
I've been working on some figures for a mansucript, and up to now everything had been going smoothly.
I was able to insert some phylopics into my individual figures with ease using your package.
However, when I started combining figures into complex layouts, the add_phylopic_base function seemed to have some trouble.
I ran your example with no problems:

posx <- runif(50, 0, 10)
posy <- runif(50, 0, 10)
sizey <- runif(50, 0.01, 0.5)
cols <- sample(c("black", "darkorange", "grey42", "white"), 50, replace = TRUE)

cat <- image_data("23cd6aa4-9587-4a2e-8e26-de42885004c9", size = 128)[[1]]
plot(posx, posy, type="n", main="A cat herd")
for (i in 1:50) {
  add_phylopic_base(cat, 1, posx[i], posy[i], sizey[i], cols[i])
}

However, if you try that in a more complex layout, it doesn't seem to plot anything (that I can see):

layout(matrix(c(1,2,3,4), nrow=2,ncol=2,byrow=TRUE))
posx <- runif(50, 0, 10)
posy <- runif(50, 0, 10)
sizey <- runif(50, 0.01, 0.5)
cols <- sample(c("black", "darkorange", "grey42", "white"), 50, replace = TRUE)

cat <- image_data("23cd6aa4-9587-4a2e-8e26-de42885004c9", size = 128)[[1]]
for(j in 1:4){
    plot(posx, posy, type="n", main="A cat herd")
    for (i in 1:50) {
      add_phylopic_base(cat, 1, posx[i], posy[i], sizey[i], cols[i])
    }
}

Other attempts produced the images, but in incorrect locations (and often smaller than requested).

I've had luck using the code here: https://scrogster.wordpress.com/2014/06/02/adding-phylopic-org-silhouettes-to-r-plots/.
You referenced that link in a different issue, and the code there seems to work fine with complex layouts.

Just figured I would let you know,
Will

Error: Not Found (HTTP 404)

HI!
I'm trying to work with images different from provided examples, but I keep getting the error in subject.
I'm interested in this pic: http://phylopic.org/name/ce1858b8-d072-4283-a985-ac06352d4ba9 (NameBank ID: 354593), so this is what I am doing:

ubio_get(namebankID = 354593)[[1]]
[1] "ce1858b8-d072-4283-a985-ac06352d4ba9" (n.b, same as in db link)

image_data("ce1858b8-d072-4283-a985-ac06352d4ba9", size = "512")
Error in png::readPNG(res$content) : libpng error: Not a PNG file

image_get(uuid = "ce1858b8-d072-4283-a985-ac06352d4ba9")
Error: Not Found (HTTP 404)

image_get(uuid = "ce1858b8-d072-4283-a985-ac06352d4ba9", options=c('credit','pngFiles','taxa','canonicalName','string','uri','type'))
Error: Not Found (HTTP 404)

...I'm just following your examples....where are my mistakes?
Thanks
s.-

Filter phylopics by license

It would be great to be able to do some filtering of returned phylopics based on their licenses. It looks like the API supports three options, which we should be able to combine into a single argument (but this argument probably needs to go in every function):

  • filter_license_by: If "true", limits results to entries with a license that requires attribution. If "false", limits results to entries with a license that does not require attribution.
  • filter_license_nc: If "true", limits results to entries with a license that does not allow commercial usage. If "false", limits results to entries with a license that allows commercial usage.
  • filter_license_sa: If "true", limits results to entries with a license with the StandAlone clause. If "false", limits results to entries with a license without the StandAlone clause.

add_phylopic_base

add_phylopic_base is plotting the shape always distorted. The aspect ratio is not kept in a proper way. Would be great if you could fix it. Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.