def create_plot_widget(self): controller = self.controller options = self.controller.options if controller.ds is None: return xaxis = controller.defaults('xaxis') if xaxis is None: xaxis = controller.ds.independent_variables[0] yaxis = controller.defaults('yaxis') if yaxis is None: yaxis = controller.ds.independent_variables[1] center = controller.defaults('center_axes') range_x = controller.defaults('range_x') range_y = controller.defaults('range_y') xlabel = Dropdown( description='* X-Axis', values=controller.ds.independent_variables, options=controller.ds.independent_variables, value=xaxis) ylabel = Dropdown( description='* Y-Axis', values=['None'] + controller.ds.independent_variables, options=['None'] + controller.ds.independent_variables, value=yaxis) xmin = FloatText(description='* X-Min', value=range_x[0]) xmax = FloatText(description='* X-Max', value=range_x[1]) ymin = FloatText(description='* Y-Min', value=range_y[0]) ymax = FloatText(description='* Y-Max', value=range_y[1]) center_axes = Checkbox(description='Center Axes', value=center) boundaries = Checkbox(description='Draw Boundaries', value=False) plot_type = Dropdown(description='* Plot Type', values=self.widget_types, options=self.widget_types, value='Design Space (interactive)') title_widget = Text(description='Title') caption_widget = Textarea(description='Caption') included = controller.defaults('included_cases') if included is None: included = [] if isinstance(included, list) is False: included = [included] included_widget = Textarea(description='Only Cases', value=', '.join(included)) wi = VBox(children=[xlabel, ylabel, plot_type, xmin, xmax, ymin, ymax, center_axes, boundaries, title_widget, caption_widget, included_widget]) for i in [xlabel, ylabel, plot_type]: i.on_trait_change(self.update_field, 'value') plot_type.widget_container = wi button = Button(value=False, description='Add Plot') button.on_click(self.make_plot) button.xlabel = xlabel button.ylabel = ylabel button.xmin = xmin button.xmax = xmax button.ymin = ymin button.ymax = ymax button.center_axes = center_axes button.boundaries = boundaries button.plot_type = plot_type button.title = title_widget button.caption = caption_widget button.included = included_widget button.wi = wi self.title = title_widget self.caption = caption_widget self.boundaries = boundaries self.plot_type = plot_type self.xlabel = xlabel self.ylabel = ylabel self.ymin = ymin self.ymax = ymax self.xmin = xmin self.xmax = xmax add_plot = VBox(description='Add Plot', children=[wi, self.plot_data, button]) self.update_plot_widget('value', 'Design Space (Interactive)') return ('Create Plot', add_plot)