Yes – there are ways you could work within or even across groups, but the process would really depend on what you are trying to achieve and the format of your data. Do you want to output multiple graphs using the same commands but different data? Or is this more exploratory, maybe both?
There are also ways to write scripts to batch process an analysis, where you pipe in data, and output a graph from a template.
Can you describe a bit more what your use case looks like?