adding grouping to plot