Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

glow

Build Status CRAN_Status_Badge

A package for making glow-y plots

The glow package is a framework for creating plots with glowing points as an alternative way of plotting large point clouds.

Gallery

Diamond Prices Glow-y Spiral
Milky Way Galaxy (6.1 million stars)
Airline Dataset (145 million points) Methylation 450K Volcano Plot
U.S. Coronavirus Cases

Installation

remotes::install_github("traversc/glow")

Some advantages over traditional techniques

  • Naturally displays point density
    • Points are added together rather than occluding earlier points in a plot
  • glow plots don’t depend on the order of points in the data (points are commutative and associative)
    • Plotting a red point over a green point is the same as a green point over a red point
  • Very fast, can be faster than geom_point depending on settings
  • Multi-threaded
  • No loss of precision and individual point coordinates compared to binning procedures
  • Naturally works with larger-than-memory datasets (See “Airline” dataset in tests/examples.r)

Usage

Creating a glow plot is done through the GlowMapper or GlowMapper4 classes, which utilize the R6 class framework.

The class function $map creates a raster that can be plotted with ggplot’s geom_raster.

See the help files and tests/examples.r for more information and examples.

library(glow)
library(ggplot2)
library(viridisLite) # Magma color scale

# Number of threads
nt <- 4

# Load the dataset
data(diamonds)
gm <- GlowMapper$new(xdim=2000, ydim = 2000, blend_mode = "screen", nthreads=nt)
gm$map(x=diamonds$carat, y=diamonds$price, intensity=1, radius = .1)
pd <- gm$output_dataframe(saturation = 1)
ggplot() + 
  geom_raster(data = pd, aes(x = pd$x, y = pd$y, fill = pd$value), show.legend = F) +
  scale_fill_gradientn(colors = additive_alpha(magma(12))) +
  coord_fixed(gm$aspect(), xlim = gm$xlim(), ylim = gm$ylim()) + 
  labs(x = "carat", y = "price") + 
  theme_night(bgcolor = magma(1))

About

No description, website, or topics provided.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.