本文整理汇总了Golang中github.com/sksullivan/plot/vg/draw.Canvas.ClipLinesX方法的典型用法代码示例。如果您正苦于以下问题:Golang Canvas.ClipLinesX方法的具体用法?Golang Canvas.ClipLinesX怎么用?Golang Canvas.ClipLinesX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/sksullivan/plot/vg/draw.Canvas
的用法示例。
在下文中一共展示了Canvas.ClipLinesX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Plot
// Plot implements the Plotter interface, drawing labels.
func (e *XErrorBars) Plot(c draw.Canvas, p *plot.Plot) {
trX, trY := p.Transforms(&c)
for i, err := range e.XErrors {
y := trY(e.XYs[i].Y)
xlow := trX(e.XYs[i].X - math.Abs(err.Low))
xhigh := trX(e.XYs[i].X + math.Abs(err.High))
bar := c.ClipLinesX([]draw.Point{{xlow, y}, {xhigh, y}})
c.StrokeLines(e.LineStyle, bar...)
e.drawCap(&c, xlow, y)
e.drawCap(&c, xhigh, y)
}
}
示例2: Plot
func (b HorizBoxPlot) Plot(c draw.Canvas, plt *plot.Plot) {
trX, trY := plt.Transforms(&c)
y := trY(b.Location)
if !c.ContainsY(y) {
return
}
y += b.Offset
med := trX(b.Median)
q1 := trX(b.Quartile1)
q3 := trX(b.Quartile3)
aLow := trX(b.AdjLow)
aHigh := trX(b.AdjHigh)
box := c.ClipLinesX([]draw.Point{
{q1, y - b.Width/2},
{q3, y - b.Width/2},
{q3, y + b.Width/2},
{q1, y + b.Width/2},
{q1, y - b.Width/2 - b.BoxStyle.Width/2},
})
c.StrokeLines(b.BoxStyle, box...)
medLine := c.ClipLinesX([]draw.Point{
{med, y - b.Width/2},
{med, y + b.Width/2},
})
c.StrokeLines(b.MedianStyle, medLine...)
cap := b.CapWidth / 2
whisks := c.ClipLinesX([]draw.Point{{q3, y}, {aHigh, y}},
[]draw.Point{{aHigh, y - cap}, {aHigh, y + cap}},
[]draw.Point{{q1, y}, {aLow, y}},
[]draw.Point{{aLow, y - cap}, {aLow, y + cap}})
c.StrokeLines(b.WhiskerStyle, whisks...)
for _, out := range b.Outside {
x := trX(b.Value(out))
if c.ContainsX(x) {
c.DrawGlyphNoClip(b.GlyphStyle, draw.Point{x, y})
}
}
}