GraphOptionsWidget¶
-
class
menpo.visualize.widgets.
GraphOptionsWidget
(graph_options, x_slider_options, y_slider_options, render_function=None, style='minimal', tabs_style='minimal', renderer_tabs_style='minimal')[source]¶ Bases:
FlexBox
Creates a widget for selecting options for rendering various curves in a graph. The widget consists of the following parts from IPython.html.widgets and menpo.visualize.widgets.tools:
No Object Variable (self.) Description 1 RendererOptionsWidget renderer_widget The rendering widget 2 FloatRangeSlider x_limit Sets the x limit 3 FloatRangeSlider y_limit Sets the y limit 4 Text x_label Sets the x label 5 Text y_label Sets the y label 6 Text title Sets the title 7 Textarea legend_entries Sets the legend entries 8 VBox graph_related_options Contains 2 - 7 9 Tab options_tab Contains 8, 1 Note that:
- The selected values are stored in the
self.selected_values
dict. - To set the styling please refer to the
style()
andpredefined_style()
methods. - To update the state of the widget, please refer to the
set_widget_state()
method. - To update the callback function please refer to the
replace_render_function()
methods.
Parameters: - graph_options (list of str) –
The initial options. For example, in case we had two curves to render
graph_options = {'legend_entries': ['Nontas', 'Leda'], 'x_label': 'X', 'y_label': 'Y', 'title': 'TITLE', 'x_axis_limits': (2, 7), 'y_axis_limits': (-0.2, 0.2), 'render_lines': [True, True], 'line_colour': ['r', 'b'], 'line_style': ['--', '-'], 'line_width': [1, 3], 'render_markers': [True, False], 'marker_style': ['o', 's'], 'marker_size': [6, 12], 'marker_face_colour': ['k', 'm'], 'marker_edge_colour': ['w', 'c'], 'marker_edge_width': [1, 4], 'render_legend': True, 'legend_title': '', 'legend_font_name': 'sans-serif', 'legend_font_style': 'normal', 'legend_font_size': 10, 'legend_font_weight': 'normal', 'legend_marker_scale': 1., 'legend_location': 2, 'legend_bbox_to_anchor': (1.05, 1.), 'legend_border_axes_pad': 0., 'legend_n_columns': 1, 'legend_horizontal_spacing': 0, 'legend_vertical_spacing': 0, 'legend_border': True, 'legend_border_padding': 0, 'legend_shadow': False, 'legend_rounded_corners': False, 'render_axes': True, 'axes_font_name': 'sans-serif', 'axes_font_size': 10, 'axes_font_style': 'normal', 'axes_font_weight': 'normal', 'figure_size': (10, 8), 'render_grid': True, 'grid_line_style': '--', 'grid_line_width': 1}
- x_slider_options ((float, float, float)) – The attributes of the x limit slider in the form (min, max, step).
- y_slider_options ((float, float, float)) – The attributes of the y limit slider in the form (min, max, step).
- render_function (function or
None
, optional) – The render function that is executed when a widgets’ value changes. IfNone
, then nothing is assigned. - style (See Below, optional) –
Sets a predefined style at the widget. Possible options are
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style - tabs_style (See Below, optional) –
Sets a predefined style at the tabs of the widget. Possible options are
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style - renderer_tabs_style (See Below, optional) –
Sets a predefined style at the tabs of the renderer widget. Possible options are
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style
-
add_render_function
(render_function)[source]¶ Method that adds a render_function() to the widget. The signature of the given function is also stored in self._render_function.
Parameters: render_function (function or None
, optional) – The render function that behaves as a callback. IfNone
, then nothing is added.
-
predefined_style
(style, tabs_style='minimal', renderer_tabs_style='mininal')[source]¶ Function that sets a predefined style on the widget.
Parameters: - style (str (see below)) –
Style options
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style - tabs_style (str (see below), optional) –
Style options
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style - renderer_tabs_style (str (see below), optional) –
Style options
Style Description ‘minimal’ Simple black and white style ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ No style
- style (str (see below)) –
-
remove_render_function
()[source]¶ Method that removes the current self._render_function() from the widget and sets
self._render_function = None
.
-
replace_render_function
(render_function)[source]¶ Method that replaces the current self._render_function() of the widget with the given render_function().
Parameters: render_function (function or None
, optional) – The render function that behaves as a callback. IfNone
, then nothing is happening.
-
style
(box_style=None, border_visible=False, border_color='black', border_style='solid', border_width=1, border_radius=0, padding='0.2cm', margin=0, tabs_box_style=None, tabs_border_visible=True, tabs_border_color='black', tabs_border_style='solid', tabs_border_width=1, tabs_border_radius=1, tabs_padding=0, tabs_margin=0, renderer_tabs_box_style=None, renderer_tabs_border_visible=True, renderer_tabs_border_color='black', renderer_tabs_border_style='solid', renderer_tabs_border_width=1, renderer_tabs_border_radius=1, renderer_tabs_padding=0, renderer_tabs_margin=0, font_family='', font_size=None, font_style='', font_weight='')[source]¶ Function that defines the styling of the widget.
Parameters: - box_style (See Below, optional) –
Style options
Style Description ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ Default style None No style - border_visible (bool, optional) – Defines whether to draw the border line around the widget.
- border_color (str, optional) – The color of the border around the widget.
- border_style (str, optional) – The line style of the border around the widget.
- border_width (float, optional) – The line width of the border around the widget.
- border_radius (float, optional) – The radius of the corners of the box.
- padding (float, optional) – The padding around the widget.
- margin (float, optional) – The margin around the widget.
- tabs_box_style (See Below, optional) –
Style options
Style Description ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ Default style None No style - tabs_border_visible (bool, optional) – Defines whether to draw the border line around the tab widgets.
- tabs_border_color (str, optional) – The color of the border around the tab widgets.
- tabs_border_style (str, optional) – The line style of the border around the tab widgets.
- tabs_border_width (float, optional) – The line width of the border around the tab widgets.
- tabs_border_radius (float, optional) – The radius of the corners of the box of the tab widgets.
- tabs_padding (float, optional) – The padding around the tab widgets.
- tabs_margin (float, optional) – The margin around the tab widgets.
- renderer_tabs_box_style (See Below, optional) –
Style options
Style Description ‘success’ Green-based style ‘info’ Blue-based style ‘warning’ Yellow-based style ‘danger’ Red-based style ‘’ Default style None No style - renderer_tabs_border_visible (bool, optional) – Defines whether to draw the border line around the tab widgets of the renderer widget.
- renderer_tabs_border_color (str, optional) – The color of the border around the tab widgets of the renderer widget.
- renderer_tabs_border_style (str, optional) – The line style of the border around the tab widgets of the renderer widget.
- renderer_tabs_border_width (float, optional) – The line width of the border around the tab widgets of the renderer widget.
- renderer_tabs_border_radius (float, optional) – The radius of the corners of the box of the tab widgets of the renderer widget.
- renderer_tabs_padding (float, optional) – The padding around the tab widgets of the renderer widget.
- renderer_tabs_margin (float, optional) – The margin around the tab widgets of the renderer widget.
- font_family (See Below, optional) –
The font family to be used. Example options
{'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace', 'helvetica'}
- font_size (int, optional) – The font size.
- font_style ({
'normal'
,'italic'
,'oblique'
}, optional) – The font style. - font_weight (See Below, optional) –
The font weight. Example options
{'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
- box_style (See Below, optional) –
- The selected values are stored in the