Giter Club home page Giter Club logo

leaflethex's Introduction

leaflethex

The goal of leaflethex is to create hexbin layers that can be added to plots made with the leaflet package.

This is a work in progress and is not yet a functional R package. Stay tuned!

Installation

You can install the released version of leaflethex from CRAN with:

install.packages("leaflethex")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("rpruim/leaflethex")

Example

This is a basic example which shows you how to add the hexbin layer to your leaflet map:

library(leaflethex)
df = tibble(
  lat = rnorm(100),
  lng = rnorm(100)
)
map <- leaflet::leaflet(df) %>% 
  leaflet::addTiles() %>% 
  leaflethex::add_hexbin(
    radius = 19, 
    lowEndColor = "yellow", 
    highEndColor="red")
map

Parameters for add_hexbin

  • data - data frame or tibble - alternate data to use for this hexbin instead of default map data

  • radius - numeric - choose the base size for the hexagons

  • opacity - decimal - between 0.0 and 1.0 - choose the percent of opacity for the hexagons

  • duration - numeric - positive milliseconds taken by the renderer to draw the hexagons

  • lowEndColor - string - choose the color for the smaller hexagons

  • highEndColor - string - choose the color for the larger hexagons

    Note About Coloring - For best readable results, use colors that have high contrast in hue and shade such as red and yellow. White is generally a safe option for the lowEndColor, but the eye is better at picking up changes in hue than changes in shade.

  • uniformSize - boolean - choose if the size of the hexagons should be uniform or variable

  • uniformColor - string - choose a color to be uniform across the different sizes of hexagons instead of variable color

  • sizeSummaryFunction - string - choose a function from ‘count’, ‘sum’, ‘max’, ‘min’, ‘mean’, or ‘median’ or give a valid JS function (in development)

  • sizevar - string - the name of the variable used to calculate the size of the hex using the sizeSummaryFunction

  • colorSummaryFunction - string - choose a function from ‘count’, ‘sum’, ‘max’, ‘min’, ‘mean’, or ‘median’ or give a valid JS function (in development)

  • colorvar - string - the name of the variable used to calculate the color of the hex using the colorSummaryFunction

leaflethex's People

Contributors

klaassenj avatar

Watchers

James Cloos avatar CRAN robot avatar  avatar

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.