Visdom: Title in figure crashes visdom rendering

Created on 29 Jan 2019  路  5Comments  路  Source: fossasia/visdom

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

  1. Create a subplot using plotly (fig = tools.make_subplots(...))
  2. Fill the fig with traces by using fig.append_trace function
  3. Update the fig layout by using fig['layout'].update(title='whatever')
  4. Upload the figure on visdom server vis.plotlyplot(fig)
  5. The visdom web rendering crashed (blue screen) after the upload

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.

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 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.

All 5 comments

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

Was this page helpful?
0 / 5 - 0 ratings