单色绘图
Single color plotly map
如何渲染只有一种颜色的 plotly
地图。在下面的示例中,我希望所有状态的填充都为红色,或 #FF0000
.
library(plotly)
library(tidyverse)
dat <- data.frame(state = state.abb)
plot_ly(dat,
type = "choropleth",
locationmode = 'USA-states',
locations = ~state) %>%
add_trace(color = "red") %>%
layout(geo = list(
projection = list(
type = "albers usa")))
根据我对 plotly 的理解 documentation 这是实现它的一种方法(choropleth 是一种热图,但你想要所有颜色都使用一种颜色):
library(plotly)
dat <- data.frame(state = state.abb)
plot_ly(dat,
type = "scattergeo",
mode = 'none',
locationmode = 'USA-states',
locations = ~state) %>%
layout(geo = list(landcolor = "#FF0000",
showland = TRUE,
projection = list(type = "albers usa")))
如何渲染只有一种颜色的 plotly
地图。在下面的示例中,我希望所有状态的填充都为红色,或 #FF0000
.
library(plotly)
library(tidyverse)
dat <- data.frame(state = state.abb)
plot_ly(dat,
type = "choropleth",
locationmode = 'USA-states',
locations = ~state) %>%
add_trace(color = "red") %>%
layout(geo = list(
projection = list(
type = "albers usa")))
根据我对 plotly 的理解 documentation 这是实现它的一种方法(choropleth 是一种热图,但你想要所有颜色都使用一种颜色):
library(plotly)
dat <- data.frame(state = state.abb)
plot_ly(dat,
type = "scattergeo",
mode = 'none',
locationmode = 'USA-states',
locations = ~state) %>%
layout(geo = list(landcolor = "#FF0000",
showland = TRUE,
projection = list(type = "albers usa")))