title: How can I adjust facet width in plotly in R?
body: <p>I'm currently in the process of creating a heatmap with <code>plotly</code>. Below is  the sample dataset:</p>
  <pre><code>library(tidyverse)
  library(plotly)
  library(hrbrthemes)
  set.seed(9999)
  df &lt;- data.frame(group.int = rep(c(rep(&quot;Prevention&quot;, 3), &quot;Diagnosis&quot;, rep(&quot;Intervention&quot;, 2)), 6),
                  int = rep(c(&quot;Prevention 1&quot;, &quot;Prevention 2&quot;, &quot;Prevention 3&quot;, &quot;Diagnosis 1&quot;, &quot;Intervention 1&quot;, &quot;Intervention 2&quot;), 6),
                  group.outcome = c(rep(&quot;Efficacy&quot;, 12), rep(&quot;Safety&quot;, 18), rep(&quot;Cost-effectiveness&quot;, 6)),
                  outcome = c(rep(&quot;Efficacy 1&quot;, 6), rep(&quot;Efficacy 2&quot;, 6), rep(&quot;Safety 1&quot;, 6), rep(&quot;Safety 2&quot;, 6), rep(&quot;Safety 3&quot;, 6), rep(&quot;Cost-effectiveness 1&quot;, 6)),
                  n = sample(50:250, 36, rep = TRUE)
              )
  df$group.int &lt;- factor(df$group.int, levels = c(&quot;Prevention&quot;, &quot;Diagnosis&quot;, &quot;Intervention&quot;))
  df$group.outcome &lt;- factor(df$group.outcome, levels = c(&quot;Efficacy&quot;, &quot;Safety&quot;, &quot;Cost-effectiveness&quot;))
  </code></pre>
  <p>I want to make a heatmap based on the variable <code>outcome</code> against <code>int</code>, with <code>n</code> as the fill of each heatmap cell. Here is the desired plot:</p>
  <p><a href="https://i.stack.imgur.com/mSXyi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mSXyi.png" alt="enter image description here" /></a></p>
  <p>I tried using <code>ggplotly</code> from the created ggplot:</p>
  <pre><code>plotly.df &lt;- ggplot(df, 
                  aes(x = int, y = outcome, fill= n)) + 
                  geom_tile() +
                  scale_fill_gradient(low=&quot;white&quot;, high=&quot;darkred&quot;) +
                  scale_y_discrete(position = &quot;right&quot;) +
                  facet_grid(group.outcome ~ group.int,
                      scales = &quot;free&quot;, space = &quot;free&quot;, switch = &quot;x&quot;) +
                  theme_bw() +
                  theme(axis.ticks = element_blank(),
                      legend.position = &quot;left&quot;,
                      strip.placement = &quot;outside&quot;, 
                      strip.background = element_blank())
  ggplotly(plotly.df)
  </code></pre>
  <p>However, <code>ggplotly</code> seems to ignore <code>space = &quot;free&quot;</code> in <code>facet_grid</code>, so the size of the cells are not proportional:</p>
  <p><a href="https://i.stack.imgur.com/pxooK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pxooK.png" alt="enter image description here" /></a></p>
  <p>Is there a way to adjust facet widths with <code>ggplotly</code>?</p>
  <p>Thank you very much in advance</p>