Skip to content

geom_GeomTextRepel not implemented, no labels on a map #2018

Description

@danton267

library(plotly)
library(ggplot2)
library(dplyr)
library(maps)
library(ggrepel)

UK <- map_data("world") %>% filter(region=="UK")
data <- world.cities %>% filter(country.etc=="UK")


p <- ggplot() +
  geom_polygon(data = UK, aes(x=long, y = lat, group = group), fill="grey", alpha=0.3) +
  geom_point( data=data, aes(x=long, y=lat, alpha=pop)) +
  geom_text_repel( data=data %>% arrange(pop) %>% tail(10), aes(x=long, y=lat, label=name), size=5) +
  geom_point( data=data %>% arrange(pop) %>% tail(10), aes(x=long, y=lat), color="red", size=3) +
  theme_void() + ylim(50,59) + coord_map() +
  theme(legend.position="none")

ggplotly(p)

The labels are not captured properly. There are supposed to be labels for the 10 largest cities, but no labels are present.

Activity

  1. changed the title [-]geom_GeomTextRepel not implemented[/-] [+]geom_GeomTextRepel not implemented, no labels on a map[/+] on Sep 25, 2021
  2. cpsievert commented on Nov 2, 2021

    @cpsievert
    Collaborator

    I'm not sure it will ever make sense to support conversion of this class of extension (including #2019) because the results change with the size of the R graphics device, and so we'd have to essentially re-implement these extensions client-side for them to work correctly on resize, which would be a very big project.

    Ideally, plotly/plotly.js#4674 would get implemented in a way that would support these extensions, but that also seems difficult/unlikely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions