Direct Plotly reporting does not retain colorscale.
See original GitHub issueHi 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)
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (15 by maintainers)
Top Results From Across the Web
Continuous color scales and color bars in Python - Plotly
This page is about using color to represent continuous data, but Plotly can also represent ... not all colors in the color scale...
Read more >Selection events in Python/v3 - Plotly
Parameters | ---------- | autocolorscale | Determines whether or not the colorscale is picked | using the sign of the input z values....
Read more >How to make Html Report readable from all browsers
It appears the report displays the graph only for me; The report is not viewable by other browsers. here is my plotly graphs:...
Read more >Dash Enterprise - Plotly
With Dash Open Source, you can create data apps on your laptop in pure Python, no JavaScript required. Get familiar with Dash by...
Read more >Static image export in Python - Plotly
Plotly allows you to save static images of your plots. ... You can export figures either to static image file formats like PNG,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 😃