Change the root color of a treemap trace when using a colorscale

When using a colorscale on a treemap trace (without providing a root) the container is shown in black:

image

library(plotly)

labels = c("A1", "A2", "A3", "A4", "A5", "B1", "B2")
parents = c("", "A1", "A2", "A3", "A4", "", "B1")
values = c("11", "12", "13", "14", "15", "20", "30")

fig <- plot_ly(
  type="treemap",
  labels=labels,
  parents=parents,
  values=values,
  marker=list(colorscale='Reds'))

fig

Example taken from here: Treemap Charts | R | Plotly

I’d like to change it to white.

In the python plotly library there is a root_color argument to do so:

fig.update_traces(root_color="lightgrey")

see: Treemap Charts | Python | Plotly

Is there any workaround to achive this in R? I can’t find the according option.

I know it’s late, but for anyone still looging for this, treemaps on plotly does have a color root parameter (root = list(color = …)). You could try it first and see if it works for you, but it didn’t work for me
My turnaround was setting the color palette inside the parameter treemapcolorway inside the layout parameter:

library(plotly)

labels = c("A1", "A2", "A3", "A4", "A5", "B1", "B2")
parents = c("", "A1", "A2", "A3", "A4", "", "B1")
values = c("11", "12", "13", "14", "15", "20", "30")

fig <- plot_ly(
  type="treemap",
  labels=labels,
  parents=parents,
  values=values) %>%
layout(treemapcolorway='Reds')

fig

@naruhiko thanks for your reply.

It can be seen in the docs, that the default root color for a treemap using treemapcolorway is white.

However, I was specifically asking for a treemap using a colorscale. Your above example ignores the provided colorscale and uses the default colors.

Here you can find the related GitHub issue: