factor out package plotting