(ax,
               axis='x',
               majorticks=10,
               minorticks=5,
               xrotation=0,
               yrotation=0)
Setup axes defaults
Setup axes defaults
Setup axes defaults
def setup_axis(ax,
               axis='x',
               majorticks=10,
               minorticks=5,
               xrotation=0,
               yrotation=0):
    """Setup axes defaults"""

    major_locator = MultipleLocator(majorticks)
    major_formatter = FormatStrFormatter('%d')
    minor_locator = MultipleLocator(minorticks)
    if axis == 'x':
        ax.xaxis.set_major_locator(major_locator)
        ax.xaxis.set_major_formatter(major_formatter)
        ax.xaxis.set_minor_locator(minor_locator)

    elif axis == 'y':
        ax.yaxis.set_major_locator(major_locator)
        ax.yaxis.set_major_formatter(major_formatter)
        ax.yaxis.set_minor_locator(minor_locator)
    elif axis == 'both':
        ax.xaxis.set_major_locator(major_locator)
        ax.xaxis.set_major_formatter(major_formatter)
        ax.yaxis.set_minor_locator(minor_locator)
        ax.yaxis.set_major_locator(major_locator)
        ax.yaxis.set_major_formatter(major_formatter)
        ax.yaxis.set_minor_locator(minor_locator)
    ax.tick_params(which='major', width=2, length=10)
    ax.tick_params(which='minor', width=1, length=6)
def setup_axis ( ax , axis = 'x' , majorticks = 10 , minorticks = 5 , xrotation = 0 , yrotation = 0 ) : major_locator = MultipleLocator ( majorticks ) major_formatter = FormatStrFormatter ( '%d' ) minor_locator = MultipleLocator ( minorticks ) if axis == 'x' : ax . xaxis . set_major_locator ( major_locator ) ax . xaxis . set_major_formatter ( major_formatter ) ax . xaxis . set_minor_locator ( minor_locator ) elif axis == 'y' : ax . yaxis . set_major_locator ( major_locator ) ax . yaxis . set_major_formatter ( major_formatter ) ax . yaxis . set_minor_locator ( minor_locator ) elif axis == 'both' : ax . xaxis . set_major_locator ( major_locator ) ax . xaxis . set_major_formatter ( major_formatter ) ax . yaxis . set_minor_locator ( minor_locator ) ax . yaxis . set_major_locator ( major_locator ) ax . yaxis . set_major_formatter ( major_formatter ) ax . yaxis . set_minor_locator ( minor_locator ) ax . tick_params ( which = 'major' , width = 2 , length = 10 ) ax . tick_params ( which = 'minor' , width = 1 , length = 6 )