scripts from matplotlib doc