plotly / plotly/plotly.R

Geometry does not show when using ggplotly function to convert ggplot plot

Open
#2,303 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Geometry does not show when using ggplotly function to convert ggplot plot, but if I hover over where the geometry is supposed to be, a hover box shows. The following warning is also displayed. If this is not related to this warning, please let me know and I'll submit the question on Stack Overflow:

Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomLabel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues

ganttplot <- ganttrify::ganttrify(
  plot,
  spots = plot,
  by_date = TRUE,
  exact_date = TRUE,
  colour_palette = RColorBrewer::brewer.pal(8,"Set2"),
  mark_years = TRUE,
  hide_wp = TRUE,
  month_number_label = FALSE,
  month_date_label = TRUE,
  x_axis_position = "bottom",
  spot_fill = NA,
  spot_size_text_relative = .8,
  spot_fontface = "plain",
  spot_border = NA,
) +
  ggplot2::labs(title = "Test Plot")

ganttplot

plotly::ggplotly(ganttplot)

![ggplot](https://github.com/plotly/plotly.R/assets/77899397/581fbd74-57a9-4aca-8a32-78431bd5ac7e)
![plotly](https://github.com/plotly/plotly.R/assets/77899397/cb319701-b9d4-4dab-aca4-8fb2264203cd)
[sample_data.csv](https://github.com/plotly/plotly.R/files/12896318/sample_data.csv)


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied R example with ggplotly and inspect the geom2trace.default warning about geom_GeomLabel(). Determine how the missing geometry is represented during conversion; done means the geometry renders in the converted plot and the warning no longer applies.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.