在Googleway中使用add_heatmap添加色标 [英] Adding color scale using add_heatmap in googleway

查看:209
本文介绍了在Googleway中使用add_heatmap添加色标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用googleway创建热图.例如,对于在?add_heatmap的帮助下给出的tram_route示例,如何添加色标,以使读者知道与该颜色关联的数字是什么?

I am creating heatmap using googleway. For example, for the tram_route example given in the help of ?add_heatmap, how can I add a color scale so that the reader knows what is the number associated with that color?

谢谢.

推荐答案

注意:

自2017年10月4日起,该图例仍在开发中,可能会发生更改,并且可能尚未100%完全正常运行.

Note:

As of 2017-10-04 the legend is still in development and is subject to change, and may not be 100% fully functional yet.

devtools::install_github("SymbolixAU/googleway")
library(googleway)

示例

set.seed(20170417)
df <- tram_route
df$weight <- sample(1:10, size = nrow(df), replace = T)

google_map(key = map_key, data = df) %>%
  add_heatmap(lat = "shape_pt_lat", lon = "shape_pt_lon", weight = "weight",
              option_radius = 0.001, legend = T)

## specifying different colour gradient
option_gradient <- c('orange', 'blue', 'mediumpurple4', 'snow4', 'thistle1')

google_map(key = map_key, data = df) %>%
 add_heatmap(lat = "shape_pt_lat", lon = "shape_pt_lon", weight = "weight",
              option_radius = 0.001, option_gradient = option_gradient, legend = T)

这篇关于在Googleway中使用add_heatmap添加色标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆