Skip to content

Commit

Permalink
Merge pull request #498 from u6052029/Drawable_notraces_bug
Browse files Browse the repository at this point in the history
BUG: Drawable figure does not render without traces, fixes #494
  • Loading branch information
GavinHuttley committed Jan 16, 2020
2 parents e03b5ae + fe72c8e commit 428398b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cogent3/draw/drawable.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,16 @@ def bound_to(self, obj):

@property
def figure(self):
if not self.traces:
if not self.traces and hasattr(self, "_build_fig"):
self._build_fig()
traces = self.traces
else:
traces = [{}]
xtitle = self.xtitle if not self.xtitle else dict(text=self.xtitle)
ytitle = self.ytitle if not self.ytitle else dict(text=self.ytitle)
self.layout.xaxis.title = xtitle
self.layout.yaxis.title = ytitle
return UnionDict(data=self.traces, layout=self.layout)
return UnionDict(data=traces, layout=self.layout)

def iplot(self, *args, **kwargs):
from plotly.offline import iplot as _iplot
Expand Down

0 comments on commit 428398b

Please sign in to comment.