from java.io import File # standard Java import from java.lang import Math from jfig.utils import Array # several array utilities from jfig.utils import MHG # the plot functions m = MHG() # initalize the plot library m.figure(); # new plot window m.reshape( [0.0, 0.5, 0.0, 0.5] ) # [xl,xr,yb,yt] fraction of screen W = 30 H = 40 m.gca().setTrafo( 0, W, 0, H ) m.colormap( 'jet' ) ncols = m.numberOfColors()-1 pixels = Array.izeros( H, W ) for i in range( H ): for j in range( W ): tmp = 0.4*i/H + 0.4*j/W + 0.2*Math.random() pixels[i][j] = int( ncols*tmp ) m.image( pixels ) m.plotCartesianAxes() m.plotGrid() m.colorbar( 'EastOutside' ) m.doZoomFit() m.save( File( 'demo3.fig' ))