Adding borders to all subplots in plotly when sharing axes

Is there some incantation I can use to have plotly::subplot draw (shared) x and y axes (without ticks, perhaps) on all subplots just so the individual subplots can be visually boxed in?

For example, I like everything about the following plot, except that:

  1. The top left subplot doesn't have a solid line/x-axis to frame its bottom; and
  2. The top right panel doesn't have a vertical line/border drawn on its y-axis to frame it:

dat <- data.frame(
  a = rnorm(100), b = rnorm(100), c = rnorm(100),
  class = sample(c("g1", "g2", "g3"), 100, replace = TRUE),
  grp = sample(c("n", "o", "p", "q", "r"), 100, replace = TRUE))

axopts <- list(linecolor = toRGB("black"), linewidth = 2, showline = TRUE)

plots <- dat %>%
  group_by(class) %>%
  do(plot = {
    plot_ly(., x = ~a, y = ~b, legendgroup = ~grp, 
            showlegend = .$class[1] == "g1") %>%
      add_markers(color = ~grp) %>%
      layout(xaxis = axopts, yaxis = axopts)
subplot(plots, nrows = 2, shareX = TRUE, shareY = TRUE)

It would be great if we could just tweak the plot a bit to look more like this:

I know that calling subplot(..., shareX = FALSE, shareY = FALSE) gets us somewhere close to that, but I kind of like a few of the bells and whistles we get when setting the share* parameters to TRUE.

Thanks in advance!

I was going to suggest doing it this way, but it appears that way doesn't currently work. I'll hopefully get to a fix for that in the coming weeks

Awesome ... thanks for taking the time to look into that.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.