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

Method DataRange

plotter/heat.go:235–254  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

233// DataRange implements the DataRange method
234// of the plot.DataRanger interface.
235func (h *HeatMap) DataRange() (xmin, xmax, ymin, ymax float64) {
236 c, r := h.GridXYZ.Dims()
237 switch c {
238 case 1: // Make a unit length when there is no neighbour.
239 xmax = h.GridXYZ.X(0) + 0.5
240 xmin = h.GridXYZ.X(0) - 0.5
241 default:
242 xmax = h.GridXYZ.X(c-1) + (h.GridXYZ.X(c-1)-h.GridXYZ.X(c-2))/2
243 xmin = h.GridXYZ.X(0) - (h.GridXYZ.X(1)-h.GridXYZ.X(0))/2
244 }
245 switch r {
246 case 1: // Make a unit length when there is no neighbour.
247 ymax = h.GridXYZ.Y(0) + 0.5
248 ymin = h.GridXYZ.Y(0) - 0.5
249 default:
250 ymax = h.GridXYZ.Y(r-1) + (h.GridXYZ.Y(r-1)-h.GridXYZ.Y(r-2))/2
251 ymin = h.GridXYZ.Y(0) - (h.GridXYZ.Y(1)-h.GridXYZ.Y(0))/2
252 }
253 return xmin, xmax, ymin, ymax
254}
255
256// GlyphBoxes implements the GlyphBoxes method
257// of the plot.GlyphBoxer interface.

Callers 2

plotRasterizedMethod · 0.95
Example_volcanoFunction · 0.95

Calls 3

DimsMethod · 0.65
XMethod · 0.65
YMethod · 0.65

Tested by 1

Example_volcanoFunction · 0.76