title: Plotly and ggplot with facet_grid in R: How to to get yaxis labels to use ticktext value instead of range value?
body: <p>I would like to use ggplot2 facets with plotly but am running into issues with the y-axis labels showing the yaxis range values instead of the ticktext. Is there something I can alter in the plotly object (using plotly_build) to get it to render correctly. I'd really like to leverage the hover features of plotly in a shiny app on ggplots. I have found a few other questions that are related to facets in plotly but most appear to redirect users to use plotly subplots instead of ggplot. In my case the facet data isn't disappearing, the yaxis is just broken.  </p>
  
  <p>Reference Question:
  <a href="https://stackoverflow.com/questions/37736103/error-plotting-chart-with-facet-wrap-and-scales-free-in-plotly#">Error plotting chart with facet_wrap and scales = &quot;free&quot; in plotly</a></p>
  
  <p>See example code below with mtcars dataset that shows the issues with facets. If you look at the ggplot object the labels are correct.</p>
  
  <p>If I reduce the number of subplots like reduce the mtcars data set to only a few models the issue appears to be resolved. Why would # of subplots impact the yaxis tick labels? It also looks like the facets/groups that are broken only have 1 item (unless it is the first yaxis), the facets that have more than 1 item (at least in this example) are plotting the yaxis correctly. Is there something I can alter in the plotly object (using plotly_build) to get it to render correctly. I'd really like to leverage the hover features of plotly in a shiny app on ggplots.</p>
  
  <pre><code>library(plotly)
  library(ggplot2)
  library(data.table)
  library(datasets)
  
  #add fake model for use in facet
  dt&lt;-data.table(mtcars)
  dt[,car.id:=rownames(mtcars)]
  dt[,model:=substr(car.id,1,regexpr(" ",car.id)-1)][model=="",model:=car.id]
  
  #Optional toggle: pick a few models and issue seems to go away 
  #Use data=dt[model %in% c("Mazda","Merc","Toyota","Honda","Hornet")]
  ggplot.test&lt;-ggplot(dt,aes(mpg,car.id))+geom_point()+facet_grid(model~.,scales="free_y",space="free",drop=TRUE)
  
  #check ggplot in Plots
  ggplot.test
  
  #broken ggplotly object in Viewer
  ggplotly(ggplot.test)
  </code></pre>
  
  <p>ggplot Plot:
  <a href="https://i.stack.imgur.com/sR6uN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sR6uN.png" alt="GGPLOT MTCARS FACET"></a></p>
  
  <p>Same plot in plotly that has broken yaxis labels:
  <a href="https://i.stack.imgur.com/0NwIl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0NwIl.jpg" alt="PLOTLY GGPLOT MTCARS FACET"></a></p>