def log_plotly_chart(self, name, figure, step=None, timestamp=None): chart = events_processors.plotly_chart(figure=figure) logged_event = LoggedEventSpec( name=name, kind=V1ArtifactKind.CHART, event=V1Event(timestamp=timestamp, step=step, chart=chart), ) self._event_logger.add_event(logged_event)
def test_plotly_chart(self): x1 = np.random.randn(200) - 2 x2 = np.random.randn(200) x3 = np.random.randn(200) + 2 hist_data = [x1, x2, x3] group_labels = ["Group 1", "Group 2", "Group 3"] p = figure_factory.create_distplot(hist_data, group_labels, bin_size=[0.1, 0.25, 0.5]) # show the results event = plotly_chart(p) assert isinstance(event.figure, dict)
def log_plotly_chart(self, name, figure, step=None, timestamp=None): """Logs a plotly chart/figure. Args: name: str, name of the figure figure: plotly.figure step: int, optional timestamp: datetime, optional """ self._log_has_events() chart = events_processors.plotly_chart(figure=figure) logged_event = LoggedEventSpec( name=name, kind=V1ArtifactKind.CHART, event=V1Event.make(timestamp=timestamp, step=step, chart=chart), ) self._event_logger.add_event(logged_event)