Fixed plot output and handle empty input fields