Don't plot data blocks that are missing a selected x/y column
authorW. Trevor King <wking@drexel.edu>
Mon, 2 Aug 2010 13:25:32 +0000 (09:25 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 2 Aug 2010 13:25:32 +0000 (09:25 -0400)
hooke/ui/gui/panel/plot.py

index a6349e0ad8e1edf872cb261d9d838a212e98086c..3652579aceb6349969e33b3f0c6a94201bf43b11 100644 (file)
@@ -257,8 +257,12 @@ class PlotPanel (Panel, wx.Panel):
 \r
         self._c['figure'].hold(True)\r
         for i,data in enumerate(self._curve.data):\r
-            axes.plot(data[:,data.info['columns'].index(self._x_column)],\r
-                      data[:,data.info['columns'].index(self._y_column)],\r
+            try:\r
+                x_col = data.info['columns'].index(self._x_column)\r
+                y_col = data.info['columns'].index(self._y_column)\r
+            except ValueError:\r
+                continue  # data is missing a required column\r
+            axes.plot(data[:,x_col], data[:,y_col],\r
                       '.',\r
                       label=data.info['name'])\r
         if config['plot legend'] == 'True':  # HACK: config should convert\r