Collecting shared functions for plotting