本文整理汇总了Python中Orange.widgets.utils.itemmodels.VariableListModel.sort方法的典型用法代码示例。如果您正苦于以下问题:Python VariableListModel.sort方法的具体用法?Python VariableListModel.sort怎么用?Python VariableListModel.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.utils.itemmodels.VariableListModel
的用法示例。
在下文中一共展示了VariableListModel.sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWBoxPlot
# 需要导入模块: from Orange.widgets.utils.itemmodels import VariableListModel [as 别名]
# 或者: from Orange.widgets.utils.itemmodels.VariableListModel import sort [as 别名]
class OWBoxPlot(widget.OWWidget):
"""
Here's how the widget's functions call each other:
- `set_data` is a signal handler fills the list boxes and calls
`grouping_changed`.
- `grouping_changed` handles changes of grouping attribute: it enables or
disables the box for ordering, orders attributes and calls `attr_changed`.
- `attr_changed` handles changes of attribute. It recomputes box data by
calling `compute_box_data`, shows the appropriate display box
(discrete/continuous) and then calls`layout_changed`
- `layout_changed` constructs all the elements for the scene (as lists of
QGraphicsItemGroup) and calls `display_changed`. It is called when the
attribute or grouping is changed (by attr_changed) and on resize event.
- `display_changed` puts the elements corresponding to the current display
settings on the scene. It is called when the elements are reconstructed
(layout is changed due to selection of attributes or resize event), or
when the user changes display settings or colors.
For discrete attributes, the flow is a bit simpler: the elements are not
constructed in advance (by layout_changed). Instead, layout_changed and
display_changed call display_changed_disc that draws everything.
"""
name = "Box Plot"
description = "Visualize the distribution of feature values in a box plot."
icon = "icons/BoxPlot.svg"
priority = 100
keywords = ["whisker"]
class Inputs:
data = Input("Data", Orange.data.Table)
class Outputs:
selected_data = Output("Selected Data", Orange.data.Table, default=True)
annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Orange.data.Table)
#: Comparison types for continuous variables
CompareNone, CompareMedians, CompareMeans = 0, 1, 2
settingsHandler = DomainContextHandler()
conditions = ContextSetting([])
attribute = ContextSetting(None)
order_by_importance = Setting(False)
group_var = ContextSetting(None)
show_annotations = Setting(True)
compare = Setting(CompareMeans)
stattest = Setting(0)
sig_threshold = Setting(0.05)
stretched = Setting(True)
show_labels = Setting(True)
sort_freqs = Setting(False)
auto_commit = Setting(True)
_sorting_criteria_attrs = {
CompareNone: "", CompareMedians: "median", CompareMeans: "mean"
}
_pen_axis_tick = QPen(Qt.white, 5)
_pen_axis = QPen(Qt.darkGray, 3)
_pen_median = QPen(QBrush(QColor(0xff, 0xff, 0x00)), 2)
_pen_paramet = QPen(QBrush(QColor(0x33, 0x00, 0xff)), 2)
_pen_dotted = QPen(QBrush(QColor(0x33, 0x00, 0xff)), 1)
_pen_dotted.setStyle(Qt.DotLine)
_post_line_pen = QPen(Qt.lightGray, 2)
_post_grp_pen = QPen(Qt.lightGray, 4)
for pen in (_pen_paramet, _pen_median, _pen_dotted,
_pen_axis, _pen_axis_tick, _post_line_pen, _post_grp_pen):
pen.setCosmetic(True)
pen.setCapStyle(Qt.RoundCap)
pen.setJoinStyle(Qt.RoundJoin)
_pen_axis_tick.setCapStyle(Qt.FlatCap)
_box_brush = QBrush(QColor(0x33, 0x88, 0xff, 0xc0))
_axis_font = QFont()
_axis_font.setPixelSize(12)
_label_font = QFont()
_label_font.setPixelSize(11)
_attr_brush = QBrush(QColor(0x33, 0x00, 0xff))
graph_name = "box_scene"
def __init__(self):
super().__init__()
self.stats = []
self.dataset = None
self.posthoc_lines = []
self.label_txts = self.mean_labels = self.boxes = self.labels = \
self.label_txts_all = self.attr_labels = self.order = []
self.scale_x = self.scene_min_x = self.scene_width = 0
self.label_width = 0
self.attrs = VariableListModel()
view = gui.listView(
#.........这里部分代码省略.........