JavaScript R Plotly: How to use config() in conjunction with plotly_build()?

Run the code up to and including plotly_build(p) and the correct plot results.

Reproducible Code

library(plotly)

#data
df1 <- data.frame(cond = factor( rep(c("A","B"), each=200) ),
                  rating = c(rnorm(200),rnorm(200, mean=.8)))

df2 <- data.frame(x=c(.5,1),cond=factor(c("A","B")))

#plot
gg <- ggplot(data=df1, aes(x=rating, fill=cond)) +
    geom_vline(aes(xintercept=mean(rating, na.rm=T))
               , color="red", linetype="dashed", size=1, name="average") +
    geom_vline(aes(xintercept=median(rating, na.rm=T))
               , color="blue", linetype="dashed", size=1, name="median", yaxt="n") +
    geom_histogram(binwidth=.5, position="dodge")

#create plotly object
p <- plotly_build(gg)

#append additional options to plot object
p$data[[1]]$hoverinfo <- "name+x" #hover options for 'average'
p$data[[2]]$hoverinfo <- "name+x" #hover options for 'median'

#display plot
plotly_build(p)
config(displayModeBar = F, showLink = F) # comment this line/config(.. out to get the plot

Problem

I want to use config to change a few settings. However, the use of config() seems to override the hoverinfo changes.

Before running config (how the plot should be)...

enter image description here

Then after running config(displayModeBar = F, showLink = F)...

enter image description here

Lastly, I tried running config prior to the hoverinfo lines:

#create plotly object
p <- plotly_build(gg)
config(p=p,displayModeBar = F, showLink = F) #run config before 'hoverinfo' changes

#append additional options to plot object
p$data[[1]]$hoverinfo <- "name+x" #hover options for 'average'
p$data[[2]]$hoverinfo <- "name+x" #hover options for 'median'

#display plot
plotly_build(p)

However, the config settings seem to be overridden with the return of the displayModeBar (screenshot below):

enter image description here

Answer:1

Adding the last config line works for me:

p <- plotly_build(gg)

p$data[[1]]$hoverinfo <- "name+x" #hover options for 'average'
p$data[[2]]$hoverinfo <- "name+x" #hover options for 'median'

p$config <- list(displayModeBar = F, showLink = F)

Derived from the source code.

Update

As of at least Plotly version 4.5.6, config is now a part of the x attribute of a Plotly object. The line should read:

p$x$config <- list(displayModeBar = F, showLink = F)
Answer:2

exports.index = function(req, res) { moviedb.indexMovie() .then(x => { Movie.findAsync() .then(responseWithResult(res)) .catch(handleError(res)) } ) }; function ...

exports.index = function(req, res) { moviedb.indexMovie() .then(x => { Movie.findAsync() .then(responseWithResult(res)) .catch(handleError(res)) } ) }; function ...

  1. javascript anonymous function with parameters
  2. javascript anonymous function this
  3. javascript anonymous function vs named
  4. javascript anonymous function return
  5. javascript anonymous function arrow
  6. javascript anonymous function example
  7. javascript anonymous function call
  8. javascript anonymous function scope
  9. javascript anonymous function return object
  10. javascript anonymous function callback
  11. javascript anonymous function syntax
  12. javascript anonymous function async
  13. javascript anonymous function arrow syntax
  14. javascript anonymous function es6
  15. javascript anonymous function closure
  16. javascript anonymous function object
  17. javascript anonymous function as argument
  18. javascript anonymous function onclick
  19. javascript anonymous function use
  20. javascript anonymous function foreach

according to the docs, I should be able to include the CSRF tokens in the header, grab them with jquery, and include them in the headers of my ajax calls. Unfortunately, including <html class='...

according to the docs, I should be able to include the CSRF tokens in the header, grab them with jquery, and include them in the headers of my ajax calls. Unfortunately, including <html class='...

Using GTM and Enhanced eCommerce: I need to track eCommerce on a third-party system and the required ID field is not called ID or transactionID ... it is called confirmID. I'm trying to retrieve a few ...

Using GTM and Enhanced eCommerce: I need to track eCommerce on a third-party system and the required ID field is not called ID or transactionID ... it is called confirmID. I'm trying to retrieve a few ...

  1. google enhanced ecommerce data layer
  2. google enhanced ecommerce analytics
  3. google enhanced ecommerce magento 2
  4. google enhanced ecommerce
  5. google enhanced ecommerce example
  6. google enhanced ecommerce add to cart
  7. google enhanced ecommerce magento 1
  8. google analytics enhanced ecommerce example
  9. google analytics enhanced ecommerce tracking
  10. google analytics enhanced ecommerce tag manager
  11. google analytics enhanced ecommerce data layer
  12. google analytics enhanced ecommerce reporting
  13. google analytics enhanced ecommerce shopify
  14. google analytics enhanced ecommerce magento 2
  15. google analytics enhanced ecommerce gtm
  16. google analytics enhanced ecommerce checkout steps
  17. google analytics enhanced ecommerce setup
  18. google analytics enhanced ecommerce events
  19. google analytics enhanced ecommerce refund
  20. google analytics enhanced ecommerce woocommerce

How to extrude a quarter Circle Geometry (THREE.CircleGeometry) in Three.js? I create the quarter circle like this: var circle = new THREE.Mesh( new THREE.CircleGeometry( 25, 32, 0, Math.PI/2 ),...

How to extrude a quarter Circle Geometry (THREE.CircleGeometry) in Three.js? I create the quarter circle like this: var circle = new THREE.Mesh( new THREE.CircleGeometry( 25, 32, 0, Math.PI/2 ),...