MCPcopy Index your code
hub / github.com/gonum/plot / size

Method size

axis.go:356–377  ·  view source on GitHub ↗

size returns the width of the axis.

()

Source from the content-addressed store, hash-verified

354
355// size returns the width of the axis.
356func (a verticalAxis) size() (w vg.Length) {
357 if a.Label.Text != "" { // We assume that the label isn't rotated.
358 w += a.Label.TextStyle.FontExtents().Descent
359 w += a.Label.TextStyle.Height(a.Label.Text)
360 w += a.Label.Padding
361 }
362
363 marks := a.Tick.Marker.Ticks(a.Min, a.Max)
364 if len(marks) > 0 {
365 if lwidth := tickLabelWidth(a.Tick.Label, marks); lwidth > 0 {
366 w += lwidth
367 w += a.Label.TextStyle.Width(" ")
368 }
369 if a.drawTicks() {
370 w += a.Tick.Length
371 }
372 }
373 w += a.Width / 2
374 w += a.Padding
375
376 return w
377}
378
379// draw draws the axis along the left side of a draw.Canvas.
380func (a verticalAxis) draw(c draw.Canvas) {

Callers 3

DrawMethod · 0.95
DataCanvasMethod · 0.95
DrawGlyphBoxesMethod · 0.95

Calls 6

tickLabelWidthFunction · 0.85
FontExtentsMethod · 0.80
HeightMethod · 0.80
drawTicksMethod · 0.80
TicksMethod · 0.65
WidthMethod · 0.45

Tested by

no test coverage detected