import os import pandas as pd import matplotlib.pyplot as plt def plot_csv_columns(csv_filename, x_column, y_column): # Read the CSV file into a DataFrame df = pd.read_csv(csv_filename) # Create the plot plt.figure(figsize=(8, 5)) plt.plot(df[x_column], df[y_column], marker='o', markersize=2, markerfacecolor='white', markeredgewidth=1, linestyle='-', linewidth=1) # Add labels and title plt.xlabel(x_column) plt.ylabel(y_column) plt.title(f'{y_column} vs {x_column}') plt.grid(True) plt.tight_layout() # Generate output filename by adding .png to channel name output_filename = f"WT_{y_column}.png" # Save and close the plot plt.savefig(output_filename, dpi=300) plt.close() print(f"\n---Plot saved successfully as '{output_filename}'\n") # Example usage: plot_csv_columns('WT_Sample_Loads.out', 'Time', 'RootMyc1')