JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
587 stars 82 forks source link

Add points to SVG football pitch #497

Open ihrychaniuk opened 1 year ago

ihrychaniuk commented 1 year ago

Hello! I try to reproduce this kind of football pitch plot (at least only with svg pitch and points) in R using echarts4r, but any attempts to add points with e_scatter or e_effect_scatter fail for me and I only can show svg image (if I delete e_scatter) from code below.

Is it possible to create similar plot using echarts4r?

data <- tibble::tibble(x = c(10,100,200,300,400),
                       y = c(10,100,200,300,400))

url <- "https://datamatic-public.github.io/echarts-2.1.10/doc/example/svg/football.svg"
svg <- url |> 
  readLines() |> 
  paste0(collapse = "")
data |> 
  e_charts(x) |> 
  e_svg_register("svg", svg) |>
  e_svg(
    x,
    map = "svg",
    label = list(
      show = FALSE
    )
  ) |> e_scatter(y)