def set_ticks( self, row="all", column="all", xy_axis="both", which="both", major_dim=(6, 2), minor_dim=(4, 1), labelsize=10, pad=10, major_tickdir="out", minor_tickdir="out", ): """ Set x and/or y axis ticks for all or specified axes. Does not set axis color Parameters ---------- row : string or list of ints Default 'all'. The rows containing the axes that need tick parameters adjusted, 'all' or list of indices column: string or list of ints Default 'all'. The columns containing the axes that need tick parameters adjusted, 'all' or list of indices. If unsure of column index for a twin x axis in ``self.axes``, find using ``self.get_twin_colnum()`` xy_axis : string Default 'both'. ['x'|'y'|'both'] which : string Default 'both'. ['major'|'minor'|'both'], the set of ticks to adjust. major_dim : tuple of ints or floats Default (6, 2). The (length, width) of the major ticks. minor_dim : tuple of ints or floats Default (4, 1). The (length, width) of the minor ticks. labelsize : int Default 10. Tick label fontsize. pad : int Default 10. Spacing between the tick and tick label. major_tickdir : string Default 'out'. ['out'|'in'|'inout']. The major tick direction. minor_tickdir : string Default 'out'. ['out'|'in'|'inout']. The minor tick direction. """ if row is "all": row = range(0, self.mainax_dim) if column is "all": column = range(0, self.total_stackdim) if which is not "major": Grid._set_ticks(self, column, row, xy_axis, "minor", minor_dim, labelsize, pad, minor_tickdir) if which is not "minor": Grid._set_ticks(self, column, row, xy_axis, "major", major_dim, labelsize, pad, major_tickdir)
def __init__(self, ystack_ratios, xratios=1, figsize=(10, 10), startside='left', alternate_sides=True, onespine_forboth=False, **kwargs): """ Initialize X_Grid Parameters ---------- ystack_ratiosratios : int or list of ints The relative sizes of the rows. Not directly comparable to ``xratios`` xratios : int or list of ints Default 1. The relative sizes of the main axis column(s). Not directly comparable to ``ystack_ratios`` figsize : tuple of ints or floats Default (10,10). The figure dimensions in inches startside : string Default 'left'. ['left'|'right']. The side the topmost y axis will be on. alternate_sides : Boolean Default ``True``. [True|False]. Stacked axis spines alternate sides or are all on ``startside``. onespine_forboth : Boolean Default ``False``. [True|False]. If the plot stack is only 1 row, then both main axis spines can be visible (``False``), or only the bottom spine (``True``). **kwargs Any plt.figure arguments. Passed to Grid.__init__(), plt.figure() """ # Initialize parent class # Last arg is True because mainax_x Grid.__init__(self, xratios, ystack_ratios, True, figsize, **kwargs) # Set initial x and y grid positions (top left) xpos = 0 ypos = 0 # Create axes row by row for rowspan in self.yratios: row = [] for c, colspan in enumerate(self.xratios): sharex = None sharey = None # All axes in a row share y axis with first axis in row if xpos > 0: sharey = row[0] # All axes in a column share x axis with first axis in column if ypos > 0: sharex = self.axes[0][c] ax = plt.subplot2grid((self.gridrows, self.gridcols), (ypos, xpos), rowspan=rowspan, colspan=colspan, sharey=sharey, sharex=sharex) ax.patch.set_visible(False) row.append(ax) xpos += colspan self.axes.append(row) # Reset x position to left side, move to next y position xpos = 0 ypos += rowspan self.set_dataside(startside, alternate_sides) self.set_stackposition(onespine_forboth)
def __init__( self, xstack_ratios, yratios=1, figsize=(10, 10), startside="top", alternate_sides=True, onespine_forboth=False, **kwargs ): """ Initialize Y_Grid Parameters ---------- xstack_ratios : int or list of ints The relative sizes of the columns. Not directly comparable to ``yratios`` yratios : int or list of ints Default 1. The relative sizes of the main axis row(s). Not directly comparable to ``xstack_ratios`` figsize : tuple of ints or floats Default (10, 10). The figure dimensions in inches startside : string Default 'top'. ['top'|'bottom']. The side the leftmost x axis will be on. alternate_sides : Boolean Default ``True``. [True|False]. Stacked axis spines alternate sides or are all on ``startside``. onespine_forboth : Boolean Default ``False``. [True|False]. If the plot stack is only 1 column, then both main axis spines can be visible (``False``), or only the left spine is visible (``True``). **kwargs Any plt.figure arguments. Passed to Grid.__init__(), plt.figure(). """ # Initialize parent class # Last arg is False because mainax_x Grid.__init__(self, xstack_ratios, yratios, False, figsize, **kwargs) # Set initial x and y grid positions (top left) xpos = 0 ypos = 0 # Create axes column by column for colspan in self.xratios: col = [] for r, rowspan in enumerate(self.yratios): sharex = None sharey = None # All axes in column share x axis with first in column if ypos > 0: sharex = col[0] # All axes in row share y axis with first in row if xpos > 0: sharey = self.axes[0][r] ax = plt.subplot2grid( (self.gridrows, self.gridcols), (ypos, xpos), rowspan=rowspan, colspan=colspan, sharex=sharex, sharey=sharey, ) ax.patch.set_visible(False) col.append(ax) ypos += rowspan self.axes.append(col) # Reset y position to top, move to next x position ypos = 0 xpos += colspan self.set_dataside(startside, alternate_sides) self.set_stackposition(onespine_forboth)