Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R package for voronoi treemaps with added interactivity by shiny

NotificationsYou must be signed in to change notification settings

uRosConf/voronoiTreemap

Repository files navigation

Build StatusCoverage StatusCRANDownloads

voronoiTreemap

This is the development place for R-package voronoiTreemap

Created at unconfUROS2018

Idea

  • Make it easy to create a plot like this:
knitr::include_graphics("documentation/preisKalei.jpg")

R package

  • https://github.com/uRosConf/voronoiTreemap
  • important functions:
    • vt_input_from_df ... easy data input as a data frame
    • vt_export_json ... export to json
    • vt_d3 ... create an htmlwidget
    • vt_app ... start a shiny to create a Voronoi treemap
library(voronoiTreemap)data(ExampleGDP)knitr::kable(head(ExampleGDP,3))
h1h2h3colorweightcodes
TotalAsiaChina#f5832114.84CN
TotalAsiaJapan#f583215.91JP
TotalAsiaIndia#f583212.83IN

Create a first graph

gdp_json<- vt_export_json(vt_input_from_df(ExampleGDP))vt_d3(gdp_json)

There a couple of settings you can change I

vt_d3(gdp_json,label=FALSE,color_border="#000000",size_border="2px",legend=TRUE)

There a couple of settings you can change II

  • You can set a seed (in Javascript)!
vt_d3(gdp_json,legend=TRUE,legend_title="Continents",seed=1)

A 2nd Example (Canadian Consumer Price Index) I

  • Colors can be provided for each cell independently.
data(canada)canada<-canada[canada$h1=="Canada",]canada$codes<-canada$h3canadaH<- vt_export_json(vt_input_from_df(canada,scaleToPerc=FALSE))vt_d3(canadaH,label=FALSE,width=400,height=400)

A 2nd Example (Canadian Consumer Price Index) II

  • Colors could be computed according to a numeric variable, e.g. with thescales package.
canada$color<-scales::seq_gradient_pal(low="#999999",high="#ffffff")(canada$weight/max(canada$weight))canadaH<- vt_export_json(vt_input_from_df(canada,scaleToPerc=FALSE))vt_d3(canadaH,label=FALSE,width=400,height=400,color_border="#000000")

Shiny App I

knitr::include_graphics("documentation/shiny1.jpg")

Shiny App II

knitr::include_graphics("documentation/shiny2.jpg")

About

R package for voronoi treemaps with added interactivity by shiny

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp