Plotly treemap child nodes not scalling numerically

Hello all I have created a treemap which has 104 nodes these nodes are arranged numerically vertical correct till 92 node but after that it is converting to horizontal arrangement from 93 to 104

HI @Sachin12 welcome to the forums.

Could you share the code which generates this figure?

Greetings to you @AIMPED
import pandas as pd

import plotly.graph_objects as go

import as px

df = pd.read_excel(r’Data.xlsx’)

treemap = go.FigureWidget( px.treemap(df, path=[‘Pack’, ‘Modules’,‘Cells’] ,color_continuous_scale=‘thermal’, height=300))

here is the code

Pack Modules Cells
0 pack module1 1
1 pack module1 2
2 pack module1 3
3 pack module1 4
4 pack module1 5
203 pack module2 204
204 pack module2 205
205 pack module2 206
206 pack module2 207
207 pack module2 208
i am not able share the xlsx file so i have copy pasted its content

Greeting @AIMPED Did you look into it

Hey @Sachin12, no, I did not.

I’ll need the data for testing. The extract you posted above (10 lines) is sufficient to reproduce the issue?

Greetings @AIMPED
Here is the full code with dataframe

import pandas as pd

import as px

import plotly.graph_objects as go

l1 = [ ]

for i in range(1,209):


df = pd.DataFrame()

df['Pack'] = ["Pack"]*208

df['Modules'] = ['Module1']*104+ ['Module2']*104

df['Cells'] = l1

treemap = go.FigureWidget( px.treemap(df, path=['Pack','Modules','Cells'] ,height=400))

I took a look at this, but I did not come to any conclusion. I played around with different number of items, it seems that the tree-map always switches the “order” at the fifth column from right.

import pandas as pd
import as px

num = 90
rng = (1, 2*num + 1)

l1 = [*range(*rng)]
pack = ["Pack" for _ in l1]
modules = [f"Module{[1, 2][i > num]}" for i in l1]
# convert int to string
#l1 = [f'{a:03d}' for a in l1]

df = pd.DataFrame({'Pack': pack, 'Modules': modules, 'Cells': l1})

treemap = px.treemap(df, path=['Pack', 'Modules', 'Cells'], height=400)