Skip to content

Commit e134654

Browse files
committed
Better PlotMethod for Python 3
1 parent 2ea532a commit e134654

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

histogrammar/util.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,18 @@ class PlotMethod(object):
5353
def __init__(self, container, plot):
5454
self.container = container
5555
self.plot = plot
56-
if hasattr(container, "plotroot"):
56+
try:
5757
self.root = container.plotroot
58-
if hasattr(container, "plotbokeh"):
58+
except (AttributeError, KeyError):
59+
pass
60+
try:
5961
self.bokeh = container.plotbokeh
60-
if hasattr(container, "plotmatplotlib"):
62+
except (AttributeError, KeyError):
63+
pass
64+
try:
6165
self.matplotlib = container.plotmatplotlib
66+
except (AttributeError, KeyError):
67+
pass
6268
def __call__(self, *args, **kwds):
6369
return self.plot(*args, **kwds)
6470

0 commit comments

Comments
 (0)