Skip to content

Commit 3fe04e0

Browse files
committed
Plotting issues question
1 parent 3fe1729 commit 3fe04e0

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Help/plottingAttempt.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import pandas as pd
2-
import numpy as np
3-
4-
def get_data_from_web(url):
5-
data = pd.read_csv(url,delimiter='\t',names= ["Contintent","Status","Order","Family","Genus","Species","Log_Mass","Combined_Mass","Reference"])
6-
return data
7-
8-
MammalData = get_data_from_web('http://www.esapubs.org/archive/ecol/E084/094/MOMv3.3.txt')
9-
1+
#3 Plotting
102
import matplotlib.pyplot as plt
3+
#Separate into Extinct and Extant Mammals for AF
114
AfricanMammals = pd.DataFrame(MammalData[MammalData['Contintent'] == 'AF'])
125
ExtinctAfricanMammals = AfricanMammals[AfricanMammals['Status'] == 'extinct']
136
ExtantAfricanMammals = AfricanMammals[AfricanMammals['Status'] == 'extant']
@@ -16,5 +9,7 @@ def get_data_from_web(url):
169
plt.hist(ExtantAfricanMammals['Log_Mass'][ExtantAfricanMammals['Log_Mass'] > 0])#, len(ExtantAfricanMammals))
1710
plt.xlabel('Log Mass (g)', fontsize=20)
1811
plt.ylabel('Individuals', fontsize= 20)
12+
#Extant Mammals will plot without a hitch, but Extinct Mammals spit out several lines of error
1913
plt.hist(ExtinctAfricanMammals['Log_Mass'][ExtinctAfricanMammals['Log_Mass'] > 0])
20-
plt.show()
14+
plt.show()
15+
#I noticed that the indexing is funny for ExtinctAfricanMammals, but I'm not sure why that matters

0 commit comments

Comments
 (0)