First, you should load recharts:

library(recharts)

# 1 Introduction

Heatmap has 1 basic type: heatmap.

The keys are:

• No need of x
• numeric y, numeric lat and lng

# 2 Function Call

echartr(data, y, lng, lat, <series>, <t>, <type>)
Arg Requirement

data

source data in the form of data.frame

y

numeric dependent variable. Only the first one is accepted. y represents the heat value which is between 0 and 1. If y is not within this range, recharts will normalize it.

series

series variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.

lng

longitude or x-coordinate.

lat

latitude or y-coordinate.

t

timeline variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.

type

‘heatmap’

# 3 Showcase

## 3.1 Data Preparation

Here is a fictious dataset.

data = rbind(
data.frame(
lng=100+rnorm(100,0, 1)*600, lat=150+rnorm(100,0, 1)*50,
y=abs(rnorm(100,0,1))),
data.frame(
lng=rnorm(200,0, 1)*1000, lat=rnorm(200,0, 1)*800,
y=abs(rnorm(200,0,1))),
data.frame(lng=400+rnorm(20,0, 1)*300, lat=5+rnorm(20,0, 1)*10,
y=abs(rnorm(100,0,1))))
str(data)
## 'data.frame':    400 obs. of  3 variables:
##  $lng: num 539.4 43.9 668.4 -192.1 -90.3 ... ##$ lat: num  166 162 273 203 121 ...
##  \$ y  : num  0.591 0.801 0.908 0.498 1.195 ...

## 3.2 Basic Plot

echartr(data,lng=lng,lat=lat,y=y,type='heatmap') %>%
setTitle("Heatmap", "Fictious Data")

Heatmap is more useful in maps. You can refer to addHeatmap for help.

# 4 Futher Setup

Then you can configure the widgets, add markLines and/or markPoints, fortify the chart.

You can refer to related functions to play around on your own.