Open caj92 opened 5 years ago
Can you paste the code you are using that shows the problem? Include your import statements.
I don't know how to do that
copy your code and paste it here
#Import python packages.
from aguaclara.core.units import unit_registry as u
u.define('equivalent = mole = eq')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import stats
import aguaclara.research.environmental_processes_analysis as epa
from scipy import optimize
import math
#$$$$$$$$$$$$$$$$$$$$$Data Analysis for Lab 2 $$$$$$$$$$$$$$$$$$$$
#Given Values
k1 = 10**-6.3
k2 = 10**-10.3
kH = 10**-1.5 *u.mol/u.L/u.atmosphere
PCo2 = 10 **-3.5 *u.atmosphere
kW = 10**-14
#Section 1: This section contains the data analysis for the lake with NaHCO3
#Part 1: Plot measured pH of the lake versus dimensionless hydraulic residence time (t/θ).
#Calculate residence time
mass_tankwater = 3766 * u.g
density_water = 0.997 * u.kg/u.L
vol_tankwater = (mass_tankwater/density_water).to(u.L)
flow_rate = (101*u.mL/(25*u.s)).to(u.L/u.s)
theta = vol_tankwater/flow_rate
# import pH data from spreadsheet located on GitHub
data_file_path_1 = "https://raw.githubusercontent.com/klr227/EnvELab/master/Acid_Rain/acid_rain_lab1.tsv"
#df = pd.read_csv(data_file_path,delimiter='\t')
# Use the epa.notes function to find what you've commented in the data file.
lakepHnotes = epa.notes(data_file_path_1)
# set the start index of the data file to one past the note indicating the start.
start_1 = 240
# Extract the pH data starting from where pump starts comment is located. pH data is in column 1
lakepH = epa.column_of_data(data_file_path_1,start_1,1)
# Extract the corresponding time data and convert to seconds
time = epa.column_of_time(data_file_path_1,start_1).to(u.s)
# Calculate dimensionless hydraulic residence time
res = time/theta
#Now plot the graph
fig, ax = plt.subplots()
ax.plot(res,lakepH,'r')
plt.xlabel('Hydraulic Residence Time')
plt.ylabel('pH')
ax.legend(['pH'])
plt.savefig('/Users/Catherine/Desktop/pHgraph')
plt.show()
Your code is good. Could you try this. Instead of executing code line by line, do the following Place your cursor anywhere in the python code. Press alt, shift, enter. That should execute all of the code at once.
Thank you that works
Every time I run a plot line, a blank graph opens up and none of the data gets plotted, even though it appears on my partner's computer.