Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fig=plt.figure()
- #ax = fig.add_subplot(111)
- ax=plt.axes()
- font0 = FontProperties()
- outgrid=[[x*y for x in range(testXaxis)] for y in range (levIndRange)]
- vmin=0
- vmax=testXaxis*levIndRange
- height = [v*1000.5 for v in range (levMaxInd)]
- colours='terrain'
- cmap=plt.cm.get_cmap(colours)
- norm=matplotlib.colors.Normalize(clip=False,vmin=vmin,vmax=vmax)
- print 'vmax = ',vmax
- m=plt.cm.ScalarMappable(cmap=cmap,norm=norm)
- m.set_array(outgrid)
- plt.imshow(np.flipud(outgrid),cmap=cmap, norm=norm, aspect=stretch)
- #ax.imshow(np.flipud(outgrid),cmap=cmap, norm=norm, aspect=stretch)
- ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
- #plt.axis.YAxis.set_major_formatter(FormatStrFormatter('%.0f')) # 'module' object has no attribute 'set_major_formatter'
- plt.yticks([s for s in range(0,levIndRange,levParInt)],[height[v] for v in range(levMinInd-1,levMaxInd-1,levParInt)])
- plt.xticks([1,3,5,7,9,11,13,15,17,19])
- #ax.xaxis.set_ticks([1,3,5,7,9,11,13,15,17,19])
- #ax.yaxis.set_ticks([height[v] for v in range(levMinInd-1,levMaxInd-1,levParInt)]) # This one line makes the plot collapse
- plt.ylabel(yLabel)
- plt.xlabel(xLabel)
- ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
- ax.xaxis.set_ticks([1,3,5,7,9,11,13,15,17,19])
- ax.yaxis.set_ticks([height[v] for v in range(levMinInd-1,levMaxInd-1,levParInt)]) # This one line makes the plot collapse
Add Comment
Please, Sign In to add comment