plotly / plotly/plotly.R

Leverage react component/editor for interactive code generation

Open
#1,336 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Programmatically placing annotations/shapes/images etc is difficult. Ideally we'd have some sort of GUI to assist in generating the relevant code. Plotly cloud does offer a solution, but there are two main issues:

  • Code generation works on the JSON-level, meaning any high-level R code gets lost.
  • The UI is complex -- it tries to do everything plotly.js can do without making common things easy.

https://github.com/plotly/react-chart-editor was recently open-sourced and could provide infrastructure for generating "focused" and locally-rendered GUIs that could help you generate code for these use-cases. For example, something like:

library(plotly)
qplot(1:10) %>%
  ggplotly() %>%
  layout_edit("annotations")

Could pop-up a shiny gadget wrapper around the react editor specifically for adding and/or editing existing annotation(s). It seems likely that we could retain the high-level (input) code and add the relevant code necessary to recreate the manual edits:

qplot(1:10) %>%
  ggplotly() %>%
  add_annotations(
    text = "My label",
    x = 0,
    y = 1,
     ...
  )

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 reading the linked react-chart-editor project and the R examples in this issue, especially the proposed layout_edit() and add_annotations() flow. The issue does not name repository files, tests, or acceptance criteria; done would require agreeing on a focused GUI, preserving high-level R code, and defining how generated edits are validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r, react
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.