plotly / plotly/plotly.R

When bookmarking, add option to NOT retain all the verbose plotly parameters

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

Nobody has claimed this yet.

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

Description

When I have a plotly plot in a bookmarkable shiny app, the bookmarking URL becomes very long and messy with lots of plotly-related data that doesn't seem too useful. It would be nice if there was an easy way to turn that off, or perhaps even just not include all this information by default.

Example app:

library(shiny)
library(plotly)

ui <- function(req) {
  fluidPage(
    bookmarkButton(),
    plotlyOutput("plot")
  )
}

server <- function(input, output, session) {
  output$plot <- renderPlotly({
    plot_ly(economics, x = ~pop)
  })
}

shinyApp(ui, server, enableBookmarking = "url", options = list(port = 3900))

When I just open this app and click on the bookmark button, I get this URL:

http://127.0.0.1:3900/?_inputs_&.clientValue-default-plotlyCrosstalkOpts=%7B%22on%22%3A%22plotly_click%22%2C%22persistent%22%3Afalse%2C%22dynamic%22%3Afalse%2C%22selectize%22%3Afalse%2C%22opacityDim%22%3A0.2%2C%22selected%22%3A%7B%22opacity%22%3A1%7D%2C%22debounce%22%3A0%2C%22color%22%3A%5B%5D%7D&.clientValue-plotly_relayout-A=%22%7B%5C%22width%5C%22%3A1570%2C%5C%22height%5C%22%3A400%7D%22

looks unnecessarily long. If I interact with this basic plot a little bit, I get an even longer URL such as

http://127.0.0.1:3900/?_inputs_&.clientValue-default-plotlyCrosstalkOpts=%7B%22on%22%3A%22plotly_click%22%2C%22persistent%22%3Afalse%2C%22dynamic%22%3Afalse%2C%22selectize%22%3Afalse%2C%22opacityDim%22%3A0.2%2C%22selected%22%3A%7B%22opacity%22%3A1%7D%2C%22debounce%22%3A0%2C%22color%22%3A%5B%5D%2C%22persistentShift%22%3Afalse%7D&.clientValue-plotly_hover-A=null&.clientValue-plotly_relayout-A=%22%7B%5C%22dragmode%5C%22%3A%5C%22lasso%5C%22%7D%22&.clientValue-plotly_selected-A=%22%5B%7B%5C%22curveNumber%5C%22%3A0%2C%5C%22x%5C%22%3A294999.5%2C%5C%22y%5C%22%3A43%7D%2C%7B%5C%22curveNumber%5C%22%3A0%2C%5C%22x%5C%22%3A304999.5%2C%5C%22y%5C%22%3A46%7D%5D%22

But even though it's so long, pasting this back into the URL bar goes back to the default plotly view and it did not retain the interactions I did. So it doesn't seem too useful to have the bookmark URL dirtied for this.

I'm not sure if this is a plotly issue, a crosstalk issue, an htmlwidgets issue, or maybe even a shiny issue. If this is the wrong place to post, let me know where it should go instead.

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 example Shiny app with URL bookmarking and compare the generated URL before and after Plotly interactions. Investigate how the bookmark URL captures the plotly-related parameters described in the report; done means there is a practical way to omit them by default or through an option without breaking useful bookmarking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization, frontend
Issue type
Feature
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.