Run the code up to and including plotly_build(p)
and the correct plot results.
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
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)...
Then after running config(displayModeBar = F, showLink = F)
...
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):
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.
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)
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 ...
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 ...
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 ),...