How to Plots.plot a GroupedDataFrame?

Hi there,

I recently asked a question on how to do grouping in Julia Plots, the answer was to encapsulate a mapping and feed the function to the group keyword in the plot function.

But learning more about DataFrames, I came across the GroupedDataFrame object. It would be quite useful to exploit this grouping with the plot function. I did not find any info on this besides how to index a GroupedDataFrame. Also not clear how to ungroup the object to obtain a DataFrame. Maybe some of you are more familiar with the compatibility of GroupedDataFrame and Plots.plot? Many thanks in advance.

I guess I could do sth like

# I would like to group e.g. cases 1,2 and 3,4,5 together!

for i in 2:length(DF)

…but this doesn’t work anyways and doesn’t really make use of the grouping… :expressionless:

Table-specific plotting functionality for Plots is factored out to StatsPlots - although it uses a @df macro, rather than a recipe for GroupedDataFrame

1 Like