code for extracting data and reproducing figures