Package smile.plot.vega
Class BinParams
java.lang.Object
smile.plot.vega.BinParams
To test a data point in a filter transform or a test property in conditional
encoding, a predicate definition of the following forms must be specified:
- a Vega expression string, where datum can be used to refer to the current data object. For example, datum.b2 > 60 would test if the value in the field b2 for each data point is over 60.
- one of the field predicates: equal, lt, lte, gt, gte, range, oneOf, or valid.
- a parameter predicate, which defines the names of a selection that the data point should belong to (or a logical composition of selections).
- a logical composition of (1), (2), or (3).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionanchor
(double value) Sets the value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.base
(int base) Sets the number base to use for automatic bin determination (default is base 10).divide
(int... factors) Sets the scale factors indicating allowable subdivisions.extent
(double min, double max) Sets the range of desired bin valuesmaxBins
(int bins) Sets the maximum number of bins.minStep
(double size) Sets the minimum allowable step size (particularly useful for integer values).nice
(int flag) If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.step
(double size) Sets the exact step size between bins.steps
(double... steps) Sets an array of allowable step sizes to choose from.
-
Constructor Details
-
BinParams
public BinParams()Constructor.
-
-
Method Details
-
anchor
Sets the value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.- Parameters:
value
- the anchor value.- Returns:
- this object.
-
base
Sets the number base to use for automatic bin determination (default is base 10).- Parameters:
base
- the base number.- Returns:
- this object.
-
divide
Sets the scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.- Parameters:
factors
- the scale factors- Returns:
- this object.
-
extent
Sets the range of desired bin values- Parameters:
min
- the lower bound of desired bin values.max
- the upper bound of desired bin values.- Returns:
- this object.
-
maxBins
Sets the maximum number of bins.- Parameters:
bins
- the maximum number of bins.- Returns:
- this object.
-
minStep
Sets the minimum allowable step size (particularly useful for integer values).- Parameters:
size
- the minimum allowable step size.- Returns:
- this object.
-
step
Sets the exact step size between bins.- Parameters:
size
- the exact step size between bins.- Returns:
- this object.
-
steps
Sets an array of allowable step sizes to choose from.- Parameters:
steps
- an array of allowable step sizes to choose from.- Returns:
- this object.
-
nice
If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.- Parameters:
flag
- If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.- Returns:
- this object.
-