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

Method DataRange

plotter/field.go:177–196  ·  view source on GitHub ↗

DataRange implements the DataRange method of the plot.DataRanger interface.

()

Source from the content-addressed store, hash-verified

175// DataRange implements the DataRange method
176// of the plot.DataRanger interface.
177func (f *Field) DataRange() (xmin, xmax, ymin, ymax float64) {
178 c, r := f.FieldXY.Dims()
179 switch c {
180 case 1: // Make a unit length when there is no neighbour.
181 xmax = f.FieldXY.X(0) + 0.5
182 xmin = f.FieldXY.X(0) - 0.5
183 default:
184 xmax = f.FieldXY.X(c-1) + (f.FieldXY.X(c-1)-f.FieldXY.X(c-2))/2
185 xmin = f.FieldXY.X(0) - (f.FieldXY.X(1)-f.FieldXY.X(0))/2
186 }
187 switch r {
188 case 1: // Make a unit length when there is no neighbour.
189 ymax = f.FieldXY.Y(0) + 0.5
190 ymin = f.FieldXY.Y(0) - 0.5
191 default:
192 ymax = f.FieldXY.Y(r-1) + (f.FieldXY.Y(r-1)-f.FieldXY.Y(r-2))/2
193 ymin = f.FieldXY.Y(0) - (f.FieldXY.Y(1)-f.FieldXY.Y(0))/2
194 }
195 return xmin, xmax, ymin, ymax
196}
197
198// GlyphBoxes implements the GlyphBoxes method
199// of the plot.GlyphBoxer interface.

Callers

nothing calls this directly

Calls 3

DimsMethod · 0.65
XMethod · 0.65
YMethod · 0.65

Tested by

no test coverage detected