Skip to content

armish/coffeewheel

Repository files navigation

An R Interface to D3-based Coffee Wheel

This is an htmlwidgets-based visualization tool for hierarchical data. It is zoomable, meaning that you can interact with the hierarchy and zoom in/out accordingly. The visualization is D3-based and the actual wheel visualization code is adapted from:

https://www.jasondavies.com/coffee-wheel/

Enjoy!

Install

This package is currently not on CRAN, but you can install it from GitHub via devtools:

library("devtools");
devtools::install_github("armish/coffeewheel");

Sample Plotting

library("coffeewheel");
coffeewheel(sampleWheelData, width=500, height=500, main="Sample Wheel Title", partitionAttribute="value");

Zoomable Wheel

Sample Data Structure

sampleWheelData <- list(
	list(
		name="R",
		children=list(
			list(name="R_1", colour="#110000"),
			list(name="R_3", colour="#330000"),
			list(name="R_5", colour="#550000"),
			list(name="R_7", colour="#770000"),
			list(name="R_9", colour="#990000"),
			list(name="R_b", colour="#bb0000"),
			list(name="R_d", colour="#dd0000"),
			list(name="R_f", colour="#ff0000")
		)
	),
	list(
		name="G",
		children=list(
			list(name="G_1", colour="#001100"),
			list(name="G_3", colour="#003300"),
			list(name="G_5", colour="#005500"),
			list(name="G_7", colour="#007700"),
			list(name="G_9", colour="#009900"),
			list(name="G_b", colour="#00bb00"),
			list(name="G_d", colour="#00dd00"),
			list(name="G_f", colour="#00ff00")
		)
	),
	list(
		name="B",
		children=list(
			list(name="B_1", colour="#000011"),
			list(name="B_3", colour="#000033"),
			list(name="B_5", colour="#000055"),
			list(name="B_7", colour="#000077"),
			list(name="B_9", colour="#000099"),
			list(name="B_b", colour="#0000bb"),
			list(name="B_d", colour="#0000dd"),
			list(name="B_f", colour="#0000ff")
		)
	)
);

Credits

This version of the wheel was adapted from Jason Davies's Coffee Wheel example. Built with D3.js. Sunburst zooming based on an example by Mike Bostock.

About

D3 Coffee Wheel visualization ported to R via htmlwidgets framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published