本文整理汇总了Python中line.Line.setPoints方法的典型用法代码示例。如果您正苦于以下问题:Python Line.setPoints方法的具体用法?Python Line.setPoints怎么用?Python Line.setPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line.Line
的用法示例。
在下文中一共展示了Line.setPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeLinesAndMarkers
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import setPoints [as 别名]
def makeLinesAndMarkers(self):
"""
Create the Lines and Markers that will be drawn on the Figure.
The Lines and Markers will only be created if they are currently
set to be visible in this DataPair.
"""
(ox, oy, w, h) = self.plot().axesRegion()
minX = self.xAxis().position()[0]
maxX = self.xAxis().end()[0]
minY = self.yAxis().position()[1]
maxY = self.yAxis().end()[1]
xPlotCoords = map(lambda value: self._xaxis.mapDataToPlot(value), self._x)
yPlotCoords = map(lambda value: self._yaxis.mapDataToPlot(value), self._y)
self._lineSegments = []
self._markers = []
# Make the line segments
if self.linesVisible():
for i in range(min(len(xPlotCoords), len(yPlotCoords)) - 1):
x1 = xPlotCoords[i]
x2 = xPlotCoords[i+1]
y1 = yPlotCoords[i]
y2 = yPlotCoords[i+1]
# Do not bother making this line because it is entirely
# outside the plot's view. This does not get all the possible
# lines, but will get some fraction of them. The rest will
# be clipped by the canvas, so we don't really have to worry
# about them. This is primarily useful for instances like when
# x=range(0, 1000) but the plot is only showing (0, 10).
if (x1 < minX and x2 < minX) or (x1 > maxX and x2 > maxX) \
or (y1 < minY and y2 < minY) or (y1 > maxY and y2 > maxY):
continue
line = Line(self.canvas(), **self._lineProps)
line.setPoints(x1,
y1,
x2,
y2,
ox,
oy)
line.setClipPath(self.plot().axesRegion())
self._lineSegments.append(line)
# Make the markers
if self.markersVisible() and self._markerClass is not None:
for x, y in zip(xPlotCoords, yPlotCoords):
# Do not bother making this marker because it is outside
# the plot's view
if (x < minX or x > maxX) or (y < minY or y > maxY):
continue
marker = self._markerClass(self.canvas(), **self._markerProps)
marker.setOrigin(ox, oy)
marker.setPosition(x, y)
self._markers.append(marker)