Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please correct the code below ( after line 6 . ) so that it really does the following: 1 . Read Soil Humidity, Soil Temperature,
Please correct the code below after line so that it really does the following:
Read Soil Humidity, Soil Temperature, Atomosphere Humidity and Atomosphere Temp values from the PlantData.csv file.
Calculate the minimum, maximum and average values for Soil and Atomosphere Temp as degrees Farenheit and the Soil and Atomosphere Humidity as a percentage.
Plot how Soil Temperature xaxis is affected by Atomosphere Humidity yaxis
Repeat step for how Soil Temperature is affected by Atomosphere Temp
Plot both in a single subplot with an appropriate title, xaxis and yaxis labels and a legend.
Save it as SoilAirPlot.pdf
import csv
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
#Read Soil Humidity, Soil Temperature, Atomosphere Humidity, and Atmosphere Temp values from the PlantData.csv file.
plantfile pdreadcsvcontentdriveMyDrivePlantData.csv
#Extracting column values for plotting
atmtemp plantfileAtomosphere Temp deg Cvalues
atmhum plantfileAtomosphere Humidity values
soiltemp plantfileSoil Temperature deg Cvalues
soilhum plantfileSoil Humidity values
#Calculate the minimum, maximum, and average values for Soil and Atmosphere Temp as degrees Fahrenheit and the Soil and Atmosphere Humidity as a percentage.
def celsiustofahrenheitcelsius:
return celsius
atmtempf celsiustofahrenheitatmtemp
soiltempf celsiustofahrenheitsoiltemp
atmtempmin minatmtempf
atmtempmax maxatmtempf
atmtempavg npmeanatmtempf
soiltempmin minsoiltempf
soiltempmax maxsoiltempf
soiltempavg npmeansoiltempf
atmhumavg npmeanatmhum
soilhumavg npmeansoilhum
printfAverage ATM Temperature: atmtempavg:fdeg F
printfAverage Soil Temperature: soiltempavg:fdeg F
printfAverage ATM Humidity: atmhumavg:f
printfAverage Soil Humidity: soilhumavg:f
#Plot how Soil Temperature xaxis is affected by Atmosphere Humidity yaxis
pltfigurefigsize
pltsubplot
pltscatteratmhum, soiltempf
plttitleSoil Temperature vs Atmosphere Humidity'
pltxlabelAtmosphere Humidity
pltylabelSoil Temperature deg F
#Plot how Soil Temperature is affected by Atmosphere Temp
pltsubplot
pltscatteratmtempf soiltempf
plttitleSoil Temperature vs Atmosphere Temperature'
pltxlabelAtmosphere Temperature deg F
pltylabelSoil Temperature deg F
#Plot both in a single subplot with an appropriate title, xaxis, and yaxis labels and a legend.
plttightlayout
pltlegendSoil Temperature'
#Save it as SoilAirPlot.pdf
pltsavefigSoilAirPlot.pdf
pltshow
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started