Versions Compared

Key

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

...

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

How to set a number of ticks along the axis

Code Block

from matplotlib.ticker import MaxNLocator
axes.xaxis.set_major_locator(MaxNLocator(4))

How to change axis label position on the plot

...

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])

or even simpler:

Code Block

axgr = fig.add_axes([0.1,  0.64, 0.80, 0.35])
axhi = fig.add_axes([0.1,  0.14, 0.35, 0.35])
axti = fig.add_axes([0.55, 0.14, 0.35, 0.35])

How to draw a color bar as a separate sub-plot

...