From e7b4785b85a687d9a10884d727b98f6f1ef6beca Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 2 Aug 2010 09:25:32 -0400 Subject: [PATCH] Don't plot data blocks that are missing a selected x/y column --- hooke/ui/gui/panel/plot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hooke/ui/gui/panel/plot.py b/hooke/ui/gui/panel/plot.py index a6349e0..3652579 100644 --- a/hooke/ui/gui/panel/plot.py +++ b/hooke/ui/gui/panel/plot.py @@ -257,8 +257,12 @@ class PlotPanel (Panel, wx.Panel): self._c['figure'].hold(True) for i,data in enumerate(self._curve.data): - axes.plot(data[:,data.info['columns'].index(self._x_column)], - data[:,data.info['columns'].index(self._y_column)], + try: + x_col = data.info['columns'].index(self._x_column) + y_col = data.info['columns'].index(self._y_column) + except ValueError: + continue # data is missing a required column + axes.plot(data[:,x_col], data[:,y_col], '.', label=data.info['name']) if config['plot legend'] == 'True': # HACK: config should convert -- 2.26.2