knitr::opts_chunk$set(echo = TRUE, fig.path = "man/figures/") require(tidyverse) require(sf)
Simple Features for Science (sffs
for short) is a warehouse of vector-based diagrams for use as heatmaps. Such diagrams can provide spatial, conceptual, or anatomical context that traditional cluster heatmaps obscure. Although structured as a package for the R programming language, all diagrams are also stored in both SVG and geojson data formats, so they are widely usable.
If you aren't already familiar with Simple Features for R, it is good to first get a feel for the basics, as well as plotting simple features and manipulating them.
While you can clone this project's repo, or install it as a package -- to get up and running fast, you can read the geojson file of the individual diagram you wish to use directly into R. Navigate to the diagram in the data-raw/ directory, copy the URL from the "Download" link for its geojson, and pass it to read_sf()
.
library(tidyverse) library(sf) sf_brain <- read_sf("https://raw.githubusercontent.com/tkoomar/sffs/master/data-raw/sf_brain_outer/sf_brain_outer.geojson") head(sf_brain)
Now, you're ready to merge it with some dat
a and plot it:
sf_brain_dat <- read_csv("https://raw.githubusercontent.com/tkoomar/sffs/master/data-raw/brain_data.csv") sf_brain %>% left_join(sf_brain_dat) %>% select(id, ends_with('pcw')) %>% plot()
For more details on plotting, see the documentation of sf
, as well as the tutorials in this repo.
Absolutely! The goal of Simple Features for Science is to make these high-quality heatmap diagrams available to the broader scientific community. Please see the github wiki for full details on contributing.
If you would like to have access to all sffs
diagrams for offline use, you can install it from github using devtools
:
devtools::install_github("tkoomar/sffs")
To plot the same data from the Using Raw Data section above with a package-installed version of sffs
:
sf_brain <- sffs::sf_brain_outer sf_brain_data <- sffs::brain_data sf_brain %>% left_join(sf_brain_data) %>% select(id, ends_with('pcw')) %>% plot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.