I'm currently working on plotting pivoted tables using matplotlib pcolor but my axes are not functioning like i would like them to. I plot the tables using:
pyl.pcolor(pivot_99)
pyl.colorbar()
pyp.suptitle('Pivot 99', fontsize=14)
pyp.xlabel('Site Number', fontsize=12)
pyp.ylabel('Site Number', fontsize=12)
pyp.yticks(arange(len(pivot_99.index)),pivot_99.index)
pyp.xticks(arange(len(pivot_99.columns)),pivot_99.columns, rotation = 90)
pyl.savefig('Pivot 99.png')
pyl.show()
Where pivot_99 is a dataframe consisting of numbers between 0 and 1. The length of the index and columns are always the same but are different values for different years. When I plot pivot_99 it looks fine:
However when I plot the 2000 Heatmap there is extra space on the top and right.
Does anyone know why this is happening or how I can fix the graph so only space with color is showing? Thanks
Try with set_xlim
and set_ylim
like in this example:
import matplotlib.pyplot as pyp
pyp.gca().set_xlim((1,10))
pyp.gca().set_ylim((1,12))
pyp.plot([1,2],[1,2])
pyp.show()
You can try with xlim=ylim=558
, I can test it because I don't have your data :(