Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
axes = fig.add_subplot(111)
axim = axes.imshow(arrwin, interpolation='nearest', origin='bottom', aspect='auto')

How to define empty axes with limits

Code Block

fig   = plt.figure(figsize=(10,10), dpi=100, facecolor='w',edgecolor='w',frameon=True)
axes  = fig.add_subplot(111)        
axes.set_xlim((-50,1750))
axes.set_ylim((-50,1750))

How to draw line

Code Block

line = lines.Line2D(arrx, arry, linewidth=1, color='r')   
axes.add_artist(line)

How to draw axis without labels

Code Block
import matplotlib.ticker as mtick
axes.xaxis.set_major_formatter( mtick.NullFormatter() )

How to rotate axis labels

Code Block
        for label in axes.get_xticklabels() :
            label.set_rotation(60)                  # rotate by 60 degree
            label.set_horizontalalignment('center') # 'right', etc.

How to change axis label position on the plot

Code Block
        axes.xaxis.set_ticks_position('top')
        axes.yaxis.set_ticks_position('right')

...

Code Block
import matplotlib.gridspec as gridspec
        gs   = gridspec.GridSpec(20, 20)
        # Naive direction        [  Y   ,   X ]
        axsa = fig.add_subplot(gs[ 1:16,  0:14])
        axsb = fig.add_subplot(gs[ 1:16, 14:19])
        axsc = fig.add_subplot(gs[16:  ,  0:14])

...

Code Block
axCB = fig.add_subplot(gs[ 0, 0:14])
colb = fig.colorbar(axim, cax=axCB, orientation='horizontal')
axCB.xaxis.set_ticks_position('top') # change position of axis labels

How draw text

Code Block

plt.text(x, y, text, fontsize=7, color='k', ha='left', rotation=45)

At the edge of matplotlib and PyQt4

...