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

Method sanitizeRange

axis.go:154–176  ·  view source on GitHub ↗

sanitizeRange ensures that the range of the axis makes sense.

()

Source from the content-addressed store, hash-verified

152// sanitizeRange ensures that the range of the
153// axis makes sense.
154func (a *Axis) sanitizeRange() {
155 if math.IsInf(a.Min, 0) {
156 a.Min = 0
157 }
158 if math.IsInf(a.Max, 0) {
159 a.Max = 0
160 }
161 if a.Min > a.Max {
162 a.Min, a.Max = a.Max, a.Min
163 }
164 if a.Min == a.Max {
165 a.Min--
166 a.Max++
167 }
168
169 if a.AutoRescale {
170 marks := a.Tick.Marker.Ticks(a.Min, a.Max)
171 for _, t := range marks {
172 a.Min = math.Min(a.Min, t.Value)
173 a.Max = math.Max(a.Max, t.Value)
174 }
175 }
176}
177
178// LinearScale an be used as the value of an Axis.Scale function to
179// set the axis to a standard linear scale.

Callers 3

DrawMethod · 0.80
DataCanvasMethod · 0.80
DrawGlyphBoxesMethod · 0.80

Calls 3

TicksMethod · 0.65
MinMethod · 0.65
MaxMethod · 0.65

Tested by

no test coverage detected