Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. fig=plt.figure()
  2. #ax = fig.add_subplot(111)
  3. ax=plt.axes()
  4. font0 = FontProperties()
  5.  
  6. outgrid=[[x*y for x in range(testXaxis)] for y in range (levIndRange)]
  7. vmin=0
  8. vmax=testXaxis*levIndRange
  9. height = [v*1000.5 for v in range (levMaxInd)]
  10.  
  11. colours='terrain'
  12. cmap=plt.cm.get_cmap(colours)
  13. norm=matplotlib.colors.Normalize(clip=False,vmin=vmin,vmax=vmax)
  14. print 'vmax = ',vmax
  15. m=plt.cm.ScalarMappable(cmap=cmap,norm=norm)
  16. m.set_array(outgrid)
  17. plt.imshow(np.flipud(outgrid),cmap=cmap, norm=norm, aspect=stretch)
  18. #ax.imshow(np.flipud(outgrid),cmap=cmap, norm=norm, aspect=stretch)
  19. ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
  20. #plt.axis.YAxis.set_major_formatter(FormatStrFormatter('%.0f')) # 'module' object has no attribute 'set_major_formatter'
  21. plt.yticks([s for s in range(0,levIndRange,levParInt)],[height[v] for v in range(levMinInd-1,levMaxInd-1,levParInt)])
  22. plt.xticks([1,3,5,7,9,11,13,15,17,19])
  23. #ax.xaxis.set_ticks([1,3,5,7,9,11,13,15,17,19])
  24. #ax.yaxis.set_ticks([height[v] for v in range(levMinInd-1,levMaxInd-1,levParInt)]) # This one line makes the plot collapse
  25. plt.ylabel(yLabel)
  26. plt.xlabel(xLabel)
  27.  
  28. ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))
  29. ax.xaxis.set_ticks([1,3,5,7,9,11,13,15,17,19])
  30. 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