We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7ba3501 + 1f12794 commit 82bf118Copy full SHA for 82bf118
lib/plot.dx
@@ -87,7 +87,12 @@ blankPlot : Plot n Unit Unit Unit = { xs = blankData
87
88
-- -- TODO: generalize beyond Float with a type class for auto scaling
89
def autoScale (xs:n=>Float) : ScaledData n Float =
90
- {scale = floatScale (minimum xs) (maximum xs), dat = xs}
+ max = maximum xs
91
+ min = minimum xs
92
+ -- Add 10% padding away from the plot area
93
+ space = (max - min) * 0.05
94
+ padding = maximum [space, max * 0.001, 0.000001]
95
+ {scale = floatScale (min - padding) (max + padding), dat = xs}
96
97
def setXData (xs:ScaledData n new) (plot:Plot n a b c) : Plot n new b c=
98
-- We can't use `setAt` here because we're changing the type
0 commit comments