I have a dictionary that looks like this:
habitat_dictionary={'trees':6,
'ponds':10,
'scrub':23}
I also have a dataframe with many columns, among which are no._trees, no._ponds, no._scrub -for example:
d = {'no._trees': [1, 2], 'no._rabbit_holes':[7,8],'no._ponds':[3,5], 'no._scrub':[3,2],'robin': [0.5, 0.6], 'dove':[0.6,0.2]}
df = pd.DataFrame(data=d)
For each key in the habitat dictionary, I want to create a graph with the key as the x-axis variable, a y-axis variable between 0 and 1, and there would be two lines: one for 'robin' and one for 'dove'.
I have been trying this:
for habitat in habitat_dictionary.keys():
out=df.set_index('no._'+str(habitat))[['robin', 'dove']
out.plot(ylim=(0, 1), xticks=out.index, legend=True)
but I am getting the error: 'TypeError: loop of ufunc does not support argument 0 of type float which has no callable rint method'
I would like to have all the graphs as subplots with a shared title