带有分组值字幕的传单图例
有没有办法为传单图例添加字幕?以下示例生成一个正常运行的图例。但是,有没有办法将子组组合到同一个图例中?
我可以想象这可以通过通过 className
参数(默认 className = "info legend"
)向图例注入自定义 CSS 代码来解决。但我对 CSS 完全是个新手。 https://www.rdocumentation.org/packages/leaflet/ versions/2.1.1/topics/addLegend
这项工作也很有帮助,它是为了 NA 级的间距而完成的(https://github.com/rstudio/leaflet/issues/615#issuecomment-656035992< /a>)
为了说明我想要的内容,我创建了不同的图例条目,但它们没有正确连接。
library(leaflet)
colors <- colorFactor(palette="viridis",
domain=gadmCHE@data$NAME_1, na.color="transparent")
Deutsch <- gadmCHE[c(1:6,9:12,14:20,22,25:26),]
Italienisch <- gadmCHE[c(21),]
Französisch <- gadmCHE[-c(1:6,9:12,14:22,25:26),]
gadmCHE %>% leaflet() %>% addTiles() %>%
addPolygons(fillColor = ~colors(NAME_1), fillOpacity = 1) %>%
addLegend(position = "topright", pal = colors, values = Deutsch@data$NAME_1, title = "Deutsch")%>%
addLegend(position = "topright", pal = colors, values = Italienisch@data$NAME_1, title = "Italiensch")%>%
addLegend(position = "topright", pal = colors, values = Französisch@data$NAME_1, title = "Französisch")
我实际上需要复制以下内容。请耐心等待,因为
我知道缩短图例条目会更好,但这会带来相当多的遗产。我不太可能在这方面取得成功。
将各州归为不同语言区域的说法不正确。
这并不完全是我想要展示的,因为在我的例子中,整个图例条目不能变得更短(即,Senkrecht durchwaschene Böden,Normal durchlässig,sehr tiefgründig)
Is there a way to add subtitles to leaflet legends? The following example produces a functioning legend. However, is there a way to combine the subgroups to the same legend?
I could imagine this could be solved by injecting custom CSS-code to the legend by the className
parameter (default className = "info legend"
). But I'm a complete novice to CSS.
https://www.rdocumentation.org/packages/leaflet/versions/2.1.1/topics/addLegend
Helpful might as well be this work, done for the spacing to the NA-class (https://github.com/rstudio/leaflet/issues/615#issuecomment-656035992)
To illustrate what I would like to have I created different legend entries, but they are not properly connected.
library(leaflet)
colors <- colorFactor(palette="viridis",
domain=gadmCHE@data$NAME_1, na.color="transparent")
Deutsch <- gadmCHE[c(1:6,9:12,14:20,22,25:26),]
Italienisch <- gadmCHE[c(21),]
Französisch <- gadmCHE[-c(1:6,9:12,14:22,25:26),]
gadmCHE %>% leaflet() %>% addTiles() %>%
addPolygons(fillColor = ~colors(NAME_1), fillOpacity = 1) %>%
addLegend(position = "topright", pal = colors, values = Deutsch@data$NAME_1, title = "Deutsch")%>%
addLegend(position = "topright", pal = colors, values = Italienisch@data$NAME_1, title = "Italiensch")%>%
addLegend(position = "topright", pal = colors, values = Französisch@data$NAME_1, title = "Französisch")
I actually would need to replicate the following. Please bear with me as
I'm aware it would be better to shorten the legend entries, but that has quite some legacy attached to it. It is unlikely I'll be successful on that.
The attribution of the Cantons to different language regions is not... correct.
It further is not exactly what I would like to show, as in my case, the whole legend entry cannot be made shorter (i.e. a, Senkrecht durchwaschene Böden, Normal durchlässig, sehr tiefgründig)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论