Lorenzo Castellino
01/11/2023, 8:21 AMplotly.JSONDataSet
. The pipeline runs fine, the plot is saved to disk and displayed in the experiment tracking section but the styling applied in the fig.update_layout()
call seem to be skipped as you can see from the second image. Everything else is displayed as desired (included menu and hover data).
Any clue on what could be the issue here?
This is the code present in the node that outputs it:
def plot_loadings(loadings: NDArray) -> go.Figure:
fig = go.Figure(layout_yaxis_range=[-1, 1], layout_xaxis_range=[-1, 1])
fig.add_traces(
go.Scattergl(
x=loadings[:, 0],
y=loadings[:, 1],
mode="markers",
hovertext=[f"Var{i+1}" for i in range(loadings.shape[0])],
)
)
x_buttons = []
y_buttons = []
for i in range(loadings.shape[1]):
x_buttons.append(
dict(
method="update",
label=f"PC{i + 1}",
args=[
{"x": [loadings[:, i]]},
],
)
)
y_buttons.append(
dict(
method="update",
label=f"PC{i + 1}",
args=[
{"y": [loadings[:, i]]},
],
)
)
fig.update_layout(
updatemenus=[
dict(buttons=x_buttons, direction="up", x=0.5, y=-0.1, active=0),
dict(
buttons=y_buttons,
direction="down",
x=-0.01,
y=0.5,
active=(1 if loadings.shape[1] > 1 else 0),
),
]
)
fig.update_layout(
{
"title": {"text": "Loadings Plot", "x": 0.5},
"width": 1000,
"height": 1000,
}
)
return fig
datajoely
01/11/2023, 9:00 AMTynan
01/11/2023, 11:27 AMupdate_layout
calls aren't working as expected. have you looked at the contents of the output JSON file for this plot? does it contain your "Loadings Plot"
title text?Lorenzo Castellino
01/11/2023, 1:01 PM"direction":"down","x":-0.01,"y":0.5}],"title":{"text":"Loadings Plot","x":0.5},"width":1000,"height":1000}}
Tynan
01/11/2023, 1:03 PMLorenzo Castellino
01/11/2023, 1:04 PMTynan
01/11/2023, 1:06 PMLorenzo Castellino
01/11/2023, 1:12 PMTynan
01/11/2023, 1:14 PMLorenzo Castellino
01/17/2023, 1:02 PMTynan
01/17/2023, 1:22 PM