refactored mean rate plotting