Toward Automated and Trustworthy Scientific Analysis and Visualization with LLM-Generated Code