Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param figure_height: The figure height in pix
:param figure_width: The figure width in pix
:param equal_aspect: If True, the axis will have a scale ratio of 1 (equal aspect)
:param progress: If True, display a progress bar of the binning process
:return plotly.graph_objs._figurewidget.FigureWidget fig: a plotly FigureWidget
"""
import plotly.graph_objs as go
import plotly.callbacks
# Define the widget components
_widget_progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0, step=0.01,
layout={'width': '95%', 'max_width': '500pix'},
description='progress')
_widget_f = vue.Select(items=['identity', 'log', 'log10', 'log1p'], v_model=f or 'identity', label='Transform')
_widget_vmin = widgets.FloatSlider(value=0, min=0, max=100, step=0.1, description='vmin%')
_widget_vmax = widgets.FloatSlider(value=100, min=0, max=100, step=0.1, description='vmax%')
_widget_selection = widgets.ToggleButtons(options=['default'], description='selection')
_widget_selection_mode = widgets.ToggleButtons(options=['replace', 'and', 'or', 'xor', 'subtract'],
value='replace',
description='mode')
_widget_selection_undo = widgets.Button(description='undo', icon='arrow-left')
_widget_selection_redo = widgets.Button(description='redo', icon='arrow-right')
_widget_history_box = widgets.HBox(children=[widgets.Label('history', layout={'width': '80px'}),
_widget_selection_undo,
_widget_selection_redo])
# Put them together in the control-widget: this is what is contained within the navigation drawer
control_widget = vue.Layout(pa_1=True, column=True, children=[_widget_f,
_widget_vmin,
_widget_vmax,
_widget_selection,
def __init__(self, viz):
super(type(self), self).__init__(column=True)
self.viz = viz
self.ds = self.viz.state.ds
column_names = self.ds.get_column_names()
self.x = v.Select(items=column_names, v_model=self.viz.state.x_expression, label='x axis')
widgets.link((self.viz.state, 'x_expression'), (self.x, 'v_model'))
self.y = v.Select(items=column_names, v_model=self.viz.state.y_expression, label='y axis')
widgets.link((self.viz.state, 'y_expression'), (self.y, 'v_model'))
self.normalize = v.Checkbox(label='normalize', v_model=self.viz.normalize)
widgets.link((self.viz, 'normalize'), (self.normalize, 'v_model'))
self.children = [self.x, self.y, self.normalize]
:param figure_height: The figure height in pix
:param figure_width: The figure width in pix
:param xlabel: String for label on x axis
:param ylabel: Same for y axis
:param label: labels or names for the data being plotted
:param title: the plot title
:param selection: Name of selection to use (or True for the 'default'), or a selection-like expresson
:param progress: If True, display a progress bar of the binning process
:return plotly.graph_objs._figurewidget.FigureWidget fig: a plotly FigureWidget
"""
import plotly.graph_objs as go
import plotly.callbacks
# Define the widget components
_widget_f = vue.Select(items=['identity', 'log', 'log10', 'log1p'], v_model=f or 'identity', label='Transform')
_widget_selection = widgets.ToggleButtons(options=['default'], description='selection')
_items = [{'text': xexpr, 'value': i} for i, xexpr in enumerate(x)]
_widget_selection_space = vue.Select(items=_items, v_model=0, label='Expression')
_widget_selection_mode = widgets.ToggleButtons(options=['replace', 'and', 'or', 'xor', 'subtract'],
value='replace',
description='mode')
_widget_selection_undo = widgets.Button(description='undo', icon='arrow-left')
_widget_selection_redo = widgets.Button(description='redo', icon='arrow-right')
_widget_history_box = widgets.HBox(children=[widgets.Label('history', layout={'width': '80px'}),
_widget_selection_undo,
_widget_selection_redo])
# Put them together in the control-widget: this is what is contained within the navigation drawer
control_widget = vue.Layout(pa_1=True, column=True, children=[_widget_f,
_widget_selection_space,
_widget_selection,
_widget_selection_mode,
def __init__(self, viz):
super(type(self), self).__init__(column=True)
self.viz = viz
self.ds = self.viz.state.ds
column_names = self.ds.get_column_names()
self.x = v.Select(items=column_names, v_model=self.viz.state.x_expression, label='x axis')
widgets.link((self.viz.state, 'x_expression'), (self.x, 'v_model'))
self.y = v.Select(items=column_names, v_model=self.viz.state.y_expression, label='y axis')
widgets.link((self.viz.state, 'y_expression'), (self.y, 'v_model'))
self.normalize = v.Checkbox(label='normalize', v_model=self.viz.normalize)
widgets.link((self.viz, 'normalize'), (self.normalize, 'v_model'))
self.children = [self.x, self.y, self.normalize]
:param ylabel: Same for y axis
:param label: labels or names for the data being plotted
:param title: the plot title
:param selection: Name of selection to use (or True for the 'default'), or a selection-like expresson
:param progress: If True, display a progress bar of the binning process
:return plotly.graph_objs._figurewidget.FigureWidget fig: a plotly FigureWidget
"""
import plotly.graph_objs as go
import plotly.callbacks
# Define the widget components
_widget_f = vue.Select(items=['identity', 'log', 'log10', 'log1p'], v_model=f or 'identity', label='Transform')
_widget_selection = widgets.ToggleButtons(options=['default'], description='selection')
_items = [{'text': xexpr, 'value': i} for i, xexpr in enumerate(x)]
_widget_selection_space = vue.Select(items=_items, v_model=0, label='Expression')
_widget_selection_mode = widgets.ToggleButtons(options=['replace', 'and', 'or', 'xor', 'subtract'],
value='replace',
description='mode')
_widget_selection_undo = widgets.Button(description='undo', icon='arrow-left')
_widget_selection_redo = widgets.Button(description='redo', icon='arrow-right')
_widget_history_box = widgets.HBox(children=[widgets.Label('history', layout={'width': '80px'}),
_widget_selection_undo,
_widget_selection_redo])
# Put them together in the control-widget: this is what is contained within the navigation drawer
control_widget = vue.Layout(pa_1=True, column=True, children=[_widget_f,
_widget_selection_space,
_widget_selection,
_widget_selection_mode,
_widget_history_box])
# The output widget
_widget_output = widgets.Output()
if choice is value:
self.value = value
break
else:
if isinstance(value, str):
for i, label in enumerate(self._labels):
if label == value:
self.value = self._choices[i]
break
else:
self.value = None
else:
self.value = None
class LinkedDropdownVuetify(v.Select):
"""
A dropdown widget that is automatically linked to a SelectionCallbackProperty
and syncs changes both ways.
* On glue's side the state is in state..
* On the UI the state is in widget_select.value which holds the index of the selected item.
* Indices are (for the moment) calculated from a list of choices (ignoring separators)
"""
def __init__(self, state, attribute_name, ui_name=None, label=None):
if label is None:
label = ui_name
super().__init__(label=label)
title = go.layout.Title(text=title, xanchor='center', x=0.5, yanchor='top')
layout = go.Layout(height=figure_height,
width=figure_width,
legend=legend,
title=title,
xaxis=go.layout.XAxis(title=xlabel or x[0]),
yaxis=go.layout.YAxis(title=ylabel or y[0],
scaleanchor='x',
scaleratio=1))
fig = go.FigureWidget(data=traces, layout=layout)
# Define the widget components
_widget_selection = widgets.ToggleButtons(options=['default'], description='selection')
_items = [{'text': xexpr + ' -vs- ' + yexpr, 'value': i} for i, (xexpr, yexpr) in enumerate(zip(x, y))]
_widget_selection_space = vue.Select(items=_items, v_model=0, label='selection space')
_widget_selection_mode = widgets.ToggleButtons(options=['replace', 'and', 'or', 'xor', 'subtract'],
value='replace',
description='mode')
_widget_selection_undo = widgets.Button(description='undo', icon='arrow-left')
_widget_selection_redo = widgets.Button(description='redo', icon='arrow-right')
_widget_history_box = widgets.HBox(children=[widgets.Label('history', layout={'width': '80px'}),
_widget_selection_undo,
_widget_selection_redo])
# Put them together in the control-widget: this is what is contained within the navigation drawer
control_widget = vue.Layout(pa_1=True, column=True, children=[_widget_selection_space,
_widget_selection,
_widget_selection_mode,
_widget_history_box])
# The output widget
_widget_output = widgets.Output()