Move the preparation/finalization code to a single place.

Refs #7668
Function to plot the selected group/pair.

Refs #7668
Merge remote-tracking branch 'origin/bugfix/7668_muon_file_not_loaded'