modified script to determine set yrange with space for legend based on data
updating figures