slightly customised version of Nick Patavalis' ppgplot