Conversation
|
maybe we shouldn't care about the reverse option if it is alone: it means "reverse input order" vs "input order", and since the default is to sort by R independently of the input order, we can ignore it. |
|
The problem here is that Another way of implementing this might be function dot(data, {x, y, r, ...options} = {}) {
([x, y] = maybeTuple(x, y));
options = {...options, x, y, r};
if (r != null) options = reverse(sort(options));
return new Dot(data, options);
}but again this doesn’t solve the problem of not knowing whether it’s safe to apply the default sort by descending r. Here are a few alternatives:
None of these feel like great options, so I’m probably inclined to do nothing until I feel more confident. |
|
Without this pull-request we would write, for example (penguinSexMassCulmenSpecies) : Plot.dot(data, Plot.reverse(Plot.sort("length", Plot.bin({r: "count"}, {
x: "body_mass_g",
y: "culmen_length_mm",
stroke: "species",
fill: "species",
fillOpacity: 0.5
}))))With a shorthand notation we don't have to compute the reducer a second time (and under a different syntax), and can write: Plot.dot(data, Plot.bin({r: "count"}, {
x: "body_mass_g",
y: "culmen_length_mm",
stroke: "species",
fill: "species",
fillOpacity: 0.5,
sortedMark: true
}))I have a slight preference for option 5, i.e. having a specific option As to whether it should be the default, I walk back a little from "it is the most common use case". (For a time series, where dots are piling up by date, we are better served by not sorting.) I still think a nicer default would be sortedMark: true, but it's not such a strong preference between true or false by default. I'm pushing an opt-in version for the moment, with a default of sortedMark: false. |
|
With the sort option for bin #334 we can write: Plot.dot(data, Plot.bin({
r: "count",
sort: "count",
reverse: true
}, {
x: "body_mass_g",
y: "culmen_length_mm",
stroke: "species",
fill: "species",
fillOpacity: 0.5
}))This is one more line of code that the sortedMark option, but it avoids introducing a new concept (assuming we still want the sort option for bins and groups, but I think we do). |
|
OK since we already have two options, let's punt on introducing a third one :)
|
it is the most common use case; deactivates as soon as the sort
or reverseoption is definedrelated: #334