code for generating plots shown to users