From: W. Trevor King Date: Mon, 2 Aug 2010 13:25:32 +0000 (-0400) Subject: Don't plot data blocks that are missing a selected x/y column X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1c648bf026c0d0c28d74d9cc1e8cfe70b74536e0;p=hooke.git Don't plot data blocks that are missing a selected x/y column --- 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