How can I group multiple things at once? I.e here ...
# datascience
p
How can I group multiple things at once? I.e here I group by month, but I’d also like group by the column
platform
. so that I can show multiple `bars`next to each other.
Copy code
shared
        .groupBy {
            date.map {
                val date = it.atOffset(ZoneOffset.UTC)
                date.monthValue.toString() + "`" + date.year.toString().takeLast(2)
            }
        }
        .count("commits")
        .plot {
            bars {
                y("commits")
                x(date)
            }
        }
First part solved! The magic is called
and
Now I only ask myself how to plot that by group with multiple bars
r
Hello Paul! Most likely you'll need something like this
p
I’m a grown developer, I found that out all by myself over the time of about three hours 🙈
I found that a very confusing api. Why should a fillColor have anything to do with how the bars are split?
r
Indeed fillColor, or any other non-positional mapping is indirectly introducing grouping. Which is confusing on the first try. But it's very common use case and that's why we decided to leave this functionality, as describing groups all the time explicitly is usually very inconvenient.
p
Have you considered finding another name? Like groupWithFillColor or something alike?
r
You may alway use explicit grouping if it looks more clear. About implicit grouping you may read in a cheatsheet: https://github.com/Kotlin/kandy/blob/main/examples/notebooks/lets-plot/lets_plot_cheatsheet.ipynb One day probably we'll deprecate implicit grouping but for now we believe it's more useful then confusing