未验证 提交 9276ca78 编写于 作者: P Peng LI 提交者: GitHub

Merge pull request #5283 from will-am/plot_to_file

Support saving figure to file
......@@ -56,7 +56,7 @@ class Ploter(object):
assert isinstance(data, PlotData)
data.append(step, value)
def plot(self):
def plot(self, path=None):
if self.__plot_is_disabled__():
return
......@@ -68,8 +68,11 @@ class Ploter(object):
titles.append(title)
self.plt.plot(data.step, data.value)
self.plt.legend(titles, loc='upper left')
self.display.clear_output(wait=True)
self.display.display(self.plt.gcf())
if path is None:
self.display.clear_output(wait=True)
self.display.display(self.plt.gcf())
else:
self.plt.savefig(path)
self.plt.gcf().clear()
def reset(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册