Hi! First time posting here.
I’m trying to create a treemap with plotly. I can’t find how to add a continuous color scale based on a variable different from the value used to create the treemap.
I’m trying to graph a CPI basket. So i have different subgroups and weights for each group and subgroup and the respective inflation per group. I would like to have as values the weights so I can have a notion of how big a group is, but also I would like the color be defined by the inflation value per group.
So far the colors correspond to the values, but not to the column I’m trying to reference it to.
fig <- plot_ly(
type="treemap",
labels= df$Categoría,
parents=df$parent,
values=df$w,
textinfo="color+percent parent+percent entry",
branchvalues='total',
color=df$yoy,
)
fig
output:
As you can see from the picture the colorbar at the right corresponds to the values of the column YoY, but the color in the graph corresponds to the value column. Any help or guidance will be greatly appreciated.