Untitled
unknown
plain_text
6 months ago
816 B
4
Indexable
import pandas as pd import matplotlib.pyplot as plt from pychem.piper import PiperPlot # Load the Excel file file_path = '/path/to/your/excel/file.xlsx' sheet_name = 'PIPER TRILINEAR' # Read the Excel sheet into a pandas dataframe df = pd.read_excel(file_path, sheet_name=sheet_name) # Extract the required columns: mg, ca, cl-, hco3-, so42-, co3- mg = df['mg'] ca = df['ca'] cl_ = df['cl-'] hco3 = df['hco3-'] so42_ = df['so42-'] co3 = df['co3-'] # Combine the extracted data into the required format cation_data = pd.DataFrame({'Ca': ca, 'Mg': mg}) anion_data = pd.DataFrame({'Cl': cl_, 'SO4': so42_, 'HCO3': hco3, 'CO3': co3}) # Create a Piper Plot piper = PiperPlot(cation_data, anion_data) # Customize the plot if needed plt.title("Piper Trilinear Diagram") plt.tight_layout() # Show the plot plt.show()
Editor is loading...
Leave a Comment