def gca(): """ Returns the currently active axes object. @rtype: Axes @return: the currently active set of axes """ if not Figure.gcf()._ca: Axes() return Figure.gcf()._ca
def __init__(self, fig=None, *args, **kwargs): self.figure = fig # grid position within figure self.at = kwargs.get('at', [0, 0]) # container for axes self.grid = {} # distance between axes self.spacing = kwargs.get('spacing', 2.) # add grid to figure if not self.figure: self.figure = Figure.gcf() self.figure.axes = [self]
def gcf(): """ Returns currently active figure. """ return Figure.gcf()
def __init__(self, fig=None, *args, **kwargs): """ Initializes axes properties. """ # parent figure self.figure = fig # legend self.legend = None # axis position self.at = kwargs.get('at', [0., 0.]) # width and height of axis self.width = kwargs.get('width', 8.) self.height = kwargs.get('height', 7.) # plots belonging to these axes self.children = [] # title above axes self.title = kwargs.get('title', '') # axes labels self.xlabel = kwargs.get('xlabel', '') self.ylabel = kwargs.get('ylabel', '') # axes limits self.xmin = kwargs.get('xmin', None) self.xmax = kwargs.get('xmax', None) self.ymin = kwargs.get('ymin', None) self.ymax = kwargs.get('ymax', None) # if true, put a margin between plots and axes self.enlargelimits = kwargs.get('enlargelimits', None) # tick positions self.xtick = kwargs.get('xtick', None) self.ytick = kwargs.get('ytick', None) # tick label precisions self.xticklabel_precision = kwargs.get('xticklabel_precision', 4) self.yticklabel_precision = kwargs.get('yticklabel_precision', 4) # tick positions self.xtick_align = kwargs.get('xtick_align', None) self.ytick_align = kwargs.get('ytick_align', None) # tick labels self.xticklabels = kwargs.get('xticklabels', None) self.yticklabels = kwargs.get('yticklabels', None) # linear or logarithmic axes self.axes_type = kwargs.get('axes_type', 'axis') # axis positions self.axis_x_line = kwargs.get('axis_x_line', None) self.axis_y_line = kwargs.get('axis_y_line', None) # bar plots self.ybar = kwargs.get('ybar', False) self.xbar = kwargs.get('xbar', False) self.bar_width = kwargs.get('bar_width', None) self.stacked = kwargs.get('stacked', False) self.interval = kwargs.get('interval', False) # controls aspect ratio self.equal = kwargs.get('equal', None) # color and style specifications self.colormap = kwargs.get('colormap', None) self.cycle_list = kwargs.get('cycle_list', None) self.cycle_list_name = kwargs.get('cycle_list_name', None) # grid lines self.grid = kwargs.get('grid', None) # axis on/off self.hide_axis = kwargs.get('hide_axis', False) # custom axes properties self.pgf_options = kwargs.get('pgf_options', []) if not self.figure: self.figure = Figure.gcf() # add axes to figure (if figure is not controlled by AxesGrid) from axesgrid import AxesGrid if not (self.figure.axes and isinstance(self.figure.axes[0], AxesGrid)): self.figure.axes.append(self) # make this axis active self.figure._ca = self
def __init__(self, fig=None, *args, **kwargs): """ Initializes axes properties. """ # parent figure self.figure = fig # legend self.legend = None # axis position self.at = kwargs.get('at', [0., 0.]) # width and height of axis self.width = kwargs.get('width', 8.) self.height = kwargs.get('height', 7.) # plots belonging to these axes self.children = [] # title above axes self.title = kwargs.get('title', '') # axes labels self.xlabel = kwargs.get('xlabel', '') self.ylabel = kwargs.get('ylabel', '') self.zlabel = kwargs.get('zlabel', '') # move axis labels closer to tick labels self.xlabel_near_ticks = kwargs.get('xlabel_near_ticks', True) self.ylabel_near_ticks = kwargs.get('ylabel_near_ticks', True) self.zlabel_near_ticks = kwargs.get('zlabel_near_ticks', True) # axes limits self.xmin = kwargs.get('xmin', None) self.xmax = kwargs.get('xmax', None) self.ymin = kwargs.get('ymin', None) self.ymax = kwargs.get('ymax', None) self.zmin = kwargs.get('zmin', None) self.zmax = kwargs.get('zmax', None) # if true, put a margin between plots and axes self.enlargelimits = kwargs.get('enlargelimits', None) # if true, axes are drawn on top of images self.axis_on_top = kwargs.get('axis_on_top', True) # if true, plots are clipped where axes end self.clip = kwargs.get('clip', None) # tick positions self.xtick = kwargs.get('xtick', None) self.ytick = kwargs.get('ytick', None) self.ztick = kwargs.get('ztick', None) # enable/disable ticks self.xminorticks = kwargs.get('xminorticks', None) self.yminorticks = kwargs.get('yminorticks', None) self.zminorticks = kwargs.get('zminorticks', None) self.xmajorticks = kwargs.get('xmajorticks', None) self.ymajorticks = kwargs.get('ymajorticks', None) self.zmajorticks = kwargs.get('zmajorticks', None) self.ticks = kwargs.get('ticks', None) # tick label rotation self.xticklabel_rotation = kwargs.get('xticklabel_rotation', None) self.yticklabel_rotation = kwargs.get('yticklabel_rotation', None) self.zticklabel_rotation = kwargs.get('zticklabel_rotation', None) # tick label precisions self.xticklabel_precision = kwargs.get('xticklabel_precision', 4) self.yticklabel_precision = kwargs.get('yticklabel_precision', 4) self.zticklabel_precision = kwargs.get('zticklabel_precision', 4) # tick positions self.xtick_align = kwargs.get('xtick_align', None) self.ytick_align = kwargs.get('ytick_align', None) self.ztick_align = kwargs.get('ztick_align', None) # tick labels self.xticklabels = kwargs.get('xticklabels', None) self.yticklabels = kwargs.get('yticklabels', None) self.zticklabels = kwargs.get('zticklabels', None) # font sizes self.title_font_size = kwargs.get('title_font_size', None) self.label_font_size = kwargs.get('label_font_size', None) self.tick_label_font_size = kwargs.get('tick_label_font_size', None) # linear or logarithmic axes self.axes_type = kwargs.get('axes_type', 'axis') # axis positions self.axis_x_line = kwargs.get('axis_x_line', None) self.axis_y_line = kwargs.get('axis_y_line', None) # axis line style self.axis_line_style = kwargs.get('axis_line_style', None) self.x_axis_line_style = kwargs.get('x_axis_line_style', None) self.y_axis_line_style = kwargs.get('y_axis_line_style', None) # bar plots self.ybar = kwargs.get('ybar', False) self.xbar = kwargs.get('xbar', False) self.bar_width = kwargs.get('bar_width', None) self.stacked = kwargs.get('stacked', False) self.interval = kwargs.get('interval', False) # controls aspect ratio self.equal = kwargs.get('equal', None) # color and style specifications self.colormap = kwargs.get('colormap', None) self.colorbar = kwargs.get('colorbar', None) self.cycle_list = kwargs.get('cycle_list', None) self.cycle_list_name = kwargs.get('cycle_list_name', None) # grid lines self.grid = kwargs.get('grid', None) # axis on/off self.hide_axis = kwargs.get('hide_axis', False) self.hide_x_axis = kwargs.get('hide_x_axis', False) self.hide_y_axis = kwargs.get('hide_y_axis', False) # custom axes properties self.pgf_options = kwargs.get('pgf_options', []) # comment LaTeX code self.comment = kwargs.get('comment', '') if not self.figure: self.figure = Figure.gcf() # add axes to figure (if figure is not controlled by AxesGrid) from axesgrid import AxesGrid if not (self.figure.axes and isinstance(self.figure.axes[0], AxesGrid)): self.figure.axes.append(self) # make this axis active self.figure._ca = self