clearml: Direct Plotly reporting does not retain colorscale.
Hi together,
first of all: I am aware of this issue: #247 and read through the conversation.
I currently face a somehow related problem, when I try to directly report a plotly figure via Logger.report_plotly
. I have a model for 3D reconstruction on neural implicit representations and want to log debug samples as 3D scatter plots, where the color of each point encodes the distance of the point to the surface. When I create the figure and save it as a static image, Everything works as expected, but when I report the figure to ClearML, all points have the same color in the dashboard, even if I explicitly specify a colorscale
for my plot.
This is the code that I use to create the scatter plot:
import numpy as np
import plotly.graph_objects as go
def plot_vertices(model, c=None, cmap=None, alpha=0.7, title=''):
marker_data = go.Scatter3d(
x=model[:, 0],
y=model[:, 1],
z=model[:, 2],
marker=go.scatter3d.Marker(size=3,
color=c if c is not None else None,
colorscale=cmap if cmap else None,
),
opacity=alpha,
mode='markers'
)
layout = go.Layout(
scene=dict(
camera=dict(up=dict(x=0, y=1, z=0),
eye=dict(x=0, y=1, z=2.5),
),
aspectmode='data',
),
width=480,
height=640,
title=title,
title_x=0.5
)
fig = go.Figure(data=marker_data,
layout=layout)
return fig
and I report the figure using:
figure = plot_vertices(X, c=y)
clearml_logger.report_plotly(title=name, series='debug',
figure=figure, iteration=step)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- Fix poltly plots converting NaN to 'nan' instead of null (issue #373) — committed to allegroai/clearml by deleted user 3 years ago
Thanks for pointing this out @RobinBaumann. The next ClearML server release should include a fix that will not override existing coloring in reported plots.
Okay we sorted it out, it seems that you had NaNs in the data, which were translated into
'nan'
, plotly will not draw'nan'
s, this is a design decision. But when plotly.py generated the plots for plotly (i.e. plt.show()), it replaced the NaNs withnull
, which plotly.js will draw. Long story short, a fix will be pushed tomorrow, no need to upgrade the server 😃Hi @eliorc Quick update, this should have been fixed in
clearml-server
1.1, a hot patch will be released after the weekend with this fix included 😄