Bug Description
When using plotlyplot function to push a plotly figure (Because I needed subplots), the rendering crash if I set a title in the figure (by using fig['layout'].update function).
Reproduction Steps
fig = tools.make_subplots(...))fig.append_trace functionfig['layout'].update(title='whatever')vis.plotlyplot(fig)Expected behavior
The plot should be visible in visdom web interface.
Client logs:
In the console of the browser, I got the javascript error n.title.match is not a function that make the page go plain blue.
Hi @wdroz - sorry I've never actually worked with subplots in visdom and am unsure what might be broken. Can you provide an executable code snippet that I can repro with rather than steps in this case? That'll help me debug more quickly
Hi @JackUrb,
Here a snippet "minimal" to reproduce the issue.
from visdom import Visdom
from plotly import tools
import plotly.graph_objs as go
import plotly.offline as py
if __name__ == '__main__':
fig = tools.make_subplots(rows=2, cols=1, subplot_titles=('first', 'second'), print_grid=False)
fig.append_trace(go.Scatter(x=[1, 2, 3], y=[1, 2, 3], name='s1'), 1, 1)
fig.append_trace(go.Scatter(x=[1, 2, 3], y=[1, 2, 3], name='s2'), 2, 1)
fig['layout'].update(title='whatever')
vis = Visdom()
# crash the visdom web view
vis.plotlyplot(fig)
# that what the plot should look like
py.plot(fig, filename='crash_example', auto_open=True)
This snippet also provide the plotly result if that can help you.
I hope this will help you
Thanks
I'm also having crashes when using go.Layout(title='my title) to send my viz.plotlyplot. Any title prevents rendering in the webbrowser. This was working ~2 months ago
Hi all - sorry I've been pretty swamped with another project and unable to investigate a fix for this just yet. My first look surfaced this line as the likely source of the problem:
https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/js/main.js#L596
Logging what is in the title attribute at/before that moment should surface what is causing the break, but I haven't gotten to try it yet.
Some more context from my first pass:
https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/py/visdom/server.py#L438
This would seem to suggest that title is ultimately stored in opts rather than layout. As plotlyplot doesn't allow populating the options manually, they are handled here:
https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/py/visdom/__init__.py#L872
For some reason I suppose the title isn't a regular string.
@JackUrb I can take a look at this
Most helpful comment
Hi all - sorry I've been pretty swamped with another project and unable to investigate a fix for this just yet. My first look surfaced this line as the likely source of the problem:
https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/js/main.js#L596
Logging what is in the
titleattribute at/before that moment should surface what is causing the break, but I haven't gotten to try it yet.Some more context from my first pass:
https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/py/visdom/server.py#L438
This would seem to suggest that title is ultimately stored in
optsrather than layout. Asplotlyplotdoesn't allow populating the options manually, they are handled here:https://github.com/facebookresearch/visdom/blob/b71063fdac0f70415abe3fefefe86c7d529d1495/py/visdom/__init__.py#L872
For some reason I suppose the title isn't a regular string.