You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
barplot could fill colors also when | not provided #476
Thanks for the post, Jan, glad that the package is useful.
The reason is that usually in tinyplot() the coloring is done for the by variable (after the |) but not for the x variable. Hence, your code above uses only one color. But you can just add solution as the by variable as well and set beside = FALSE:
plt(
seconds ~ solution | solution,
facet = rows ~ window, facet.args = list(free=TRUE),
data = d, #subset = dim=="single" & rolling=="mean",
fill = c(data.table="#1B9E77", pandas="#D95F02", polars="#7570B3"),
col = NA,
type = "barplot", beside = FALSE,
grid = TRUE, frame = FALSE,
main = "Rolling mean"
)
Thanks @jangorecki, I agree that this would be nice to support. Perhaps we can take another look at the colour/fill recycling logic specifically for barplots to match the x-axis categories?
Minor point(s) in addition to @zeileis's idiomatic workaround: frame = FALSE is redundant here and you may also wish to switch off the legend with legend = FALSE.
The colour/fill recycling when no by variable is used, is not just relevant for barplots, I think. I've set up a minimal example in the new issue #483.
Activity
zeileis commentedon Sep 16, 2025
Thanks for the post, Jan, glad that the package is useful.
The reason is that usually in
tinyplot()the coloring is done for thebyvariable (after the|) but not for thexvariable. Hence, your code above uses only one color. But you can just addsolutionas thebyvariable as well and setbeside = FALSE:grantmcdermott commentedon Sep 16, 2025
Thanks @jangorecki, I agree that this would be nice to support. Perhaps we can take another look at the colour/fill recycling logic specifically for barplots to match the x-axis categories?
Minor point(s) in addition to @zeileis's idiomatic workaround:
frame = FALSEis redundant here and you may also wish to switch off the legend withlegend = FALSE.(Impressive benchmarks btw!)
jangorecki commentedon Sep 16, 2025
Thanks @zeileis, works perfect.
@grantmcdermott trick suggested by @zeileis works pretty neat. I don't think anything more is needed here so will close the issue.
This was plot for
rolling mean, much more impressive is forrolling median.A novel algorithm published in 2014, Rdatatable/data.table#7315
few more plots at https://github.com/jangorecki/rollbench
zeileis commentedon Sep 17, 2025
The colour/fill recycling when no
byvariable is used, is not just relevant for barplots, I think. I've set up a minimal example in the new issue #483.