本文整理汇总了Python中Orange.widgets.visualize.owlinearprojection.LegendItem.restoreAnchor方法的典型用法代码示例。如果您正苦于以下问题:Python LegendItem.restoreAnchor方法的具体用法?Python LegendItem.restoreAnchor怎么用?Python LegendItem.restoreAnchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.widgets.visualize.owlinearprojection.LegendItem
的用法示例。
在下文中一共展示了LegendItem.restoreAnchor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWMDS
# 需要导入模块: from Orange.widgets.visualize.owlinearprojection import LegendItem [as 别名]
# 或者: from Orange.widgets.visualize.owlinearprojection.LegendItem import restoreAnchor [as 别名]
#.........这里部分代码省略.........
)
pen = QtGui.QPen(QtGui.QBrush(QtGui.QColor(204, 204, 204)), 2)
pen.setCosmetic(True)
item.setPen(pen)
self.plot.addItem(item)
data = numpy.arange(size)
self._scatter_item = item = ScatterPlotItem(
x=emb_x, y=emb_y,
pen=self._pen_data, brush=self._brush_data, symbol=self._shape_data,
size=self._size_data, data=data,
antialias=True
)
self.plot.addItem(item)
if self._label_data is not None:
if self.label_only_selected:
if self._selection_mask is not None:
for (x, y), text_item, selected \
in zip(self.embedding, self._label_data,
self._selection_mask):
if selected:
self.plot.addItem(text_item)
text_item.setPos(x, y)
else:
for (x, y), text_item in zip(self.embedding, self._label_data):
self.plot.addItem(text_item)
text_item.setPos(x, y)
self._legend_item = LegendItem()
viewbox = self.plot.getViewBox()
self._legend_item.setParentItem(self.plot.getViewBox())
self._legend_item.setZValue(viewbox.zValue() + 10)
self._legend_item.restoreAnchor(self.legend_anchor)
color_var = shape_var = None
color_index = self.cb_color_value.currentIndex()
if have_data and 1 <= color_index < len(self.colorvar_model):
color_var = self.colorvar_model[color_index]
assert isinstance(color_var, Orange.data.Variable)
shape_index = self.cb_shape_value.currentIndex()
if have_data and 1 <= shape_index < len(self.shapevar_model):
shape_var = self.shapevar_model[shape_index]
assert isinstance(shape_var, Orange.data.Variable)
if shape_var is not None or \
(color_var is not None and color_var.is_discrete):
legend_data = mdsplotutils.legend_data(
color_var, shape_var, plotstyle=plotstyle)
for color, symbol, text in legend_data:
self._legend_item.addItem(
ScatterPlotItem(pen=color, brush=color, symbol=symbol,
size=10),
escape(text)
)
else:
self._legend_item.hide()
def commit(self):
if self.embedding is not None:
output = embedding = Orange.data.Table.from_numpy(
Orange.data.Domain([Orange.data.ContinuousVariable("X"),
Orange.data.ContinuousVariable("Y")]),
self.embedding