Tensorboardx: How to use add_figure()? Why i can't show it in tensorboard correctly.

Created on 22 Oct 2018  路  4Comments  路  Source: lanpa/tensorboardX

here is my code.

writer = tensorboardX.SummaryWriter('run/exp-1')
figure = matplotlib.pyplot.figure()
x = np.linspace(-1, 1, 50)
y = 2 * x + 1
plt.plot(x, y)
plt.show()
writer.add_figure("matplotlib/figure", figure)

but there is nothing is tensorboard. Any bug in my code?
And why there is no 'Figure' selection in menu bar?

Most helpful comment

Wouldn't your code blocked on plt.show()?

There's a demo:
https://github.com/lanpa/tensorboardX/blob/master/examples/demo_matplotlib.py
You are right锛宻how() actually block . But there is still nothing in my tensorboard and then I notice my torch version is 0.3.1. Maybe it's reason.
Thank you very much!

All 4 comments

Wouldn't your code blocked on plt.show()?

There's a demo:
https://github.com/lanpa/tensorboardX/blob/master/examples/demo_matplotlib.py

Wouldn't your code blocked on plt.show()?

There's a demo:
https://github.com/lanpa/tensorboardX/blob/master/examples/demo_matplotlib.py
You are right锛宻how() actually block . But there is still nothing in my tensorboard and then I notice my torch version is 0.3.1. Maybe it's reason.
Thank you very much!

The torch version should have nothing to do with this issue. Does the demo work for you?

The torch version should have nothing to do with this issue. Does the demo work for you?

I try it again, it works! : )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JiamingSuen picture JiamingSuen  路  8Comments

hrtang picture hrtang  路  4Comments

mlagunas picture mlagunas  路  5Comments

ZhengRui picture ZhengRui  路  7Comments

chinmay5 picture chinmay5  路  5Comments