Ejemplo n.º 1
0
    def __init__(self, axes):
        """
        Init the axis with the parent Axes instance
        """
        Artist.__init__(self)
        self.set_figure(axes.figure)

        self.axes = axes

        self.set_major_locator(AutoLocator())
        self.set_minor_locator(NullLocator())

        self.set_major_formatter(ScalarFormatter())
        self.set_minor_formatter(NullFormatter())

        # whether the grids are on
        self._gridOnMajor = rcParams['axes.grid']
        self._gridOnMinor = False

        self.label = self._get_label()
        self._set_artist_props(self.label)

        # build a few default ticks; grow as necessary later; only
        # define 1 so properties set on ticks will be copied as they
        # grow
        self.majorTicks = [self._get_tick(major=True) for i in range(1)]
        self.minorTicks = [self._get_tick(major=False) for i in range(1)]
Ejemplo n.º 2
0
    def cla(self):
        'clear the current axis'
        self.set_major_locator(AutoLocator())
        self.set_major_formatter(ScalarFormatter())
        self.set_minor_locator(NullLocator())
        self.set_minor_formatter(NullFormatter())

        # Clear the callback registry for this axis, or it may "leak"
        self.callbacks = CallbackRegistry(('units', 'units finalize'))

        # whether the grids are on
        self._gridOnMajor = rcParams['axes.grid']
        self._gridOnMinor = False

        self.label.set_text('')
        self._set_artist_props(self.label)

        # build a few default ticks; grow as necessary later; only
        # define 1 so properties set on ticks will be copied as they
        # grow

        popall(self.majorTicks)
        popall(self.minorTicks)

        self.majorTicks.extend([self._get_tick(major=True)  for i in range(1)])
        self.minorTicks.extend([self._get_tick(major=False) for i in range(1)])

        self.converter = None
        self.units = None
        self.set_units(None)
Ejemplo n.º 3
0
 def set_default_locators_and_formatters(self, axis):
     """
     Set the locators and formatters to reasonable defaults for
     linear scaling.
     """
     axis.set_major_locator(AutoLocator())
     axis.set_major_formatter(ScalarFormatter())
     axis.set_minor_locator(NullLocator())
     axis.set_minor_formatter(NullFormatter())
Ejemplo n.º 4
0
    def cla(self):
        'clear the current axis'
        self.set_major_locator(AutoLocator())
        self.set_major_formatter(ScalarFormatter())
        self.set_minor_locator(NullLocator())
        self.set_minor_formatter(NullFormatter())

        # whether the grids are on
        self._gridOnMajor = rcParams['axes.grid']
        self._gridOnMinor = False

        self.label.set_text('')
        self._set_artist_props(self.label)

        # build a few default ticks; grow as necessary later; only
        # define 1 so properties set on ticks will be copied as they
        # grow

        popall(self.majorTicks)
        popall(self.minorTicks)

        self.majorTicks.extend([self._get_tick(major=True) for i in range(1)])
        self.minorTicks.extend([self._get_tick(major=False) for i in range(1)])
Ejemplo n.º 5
0
 def set_default_locators_and_formatters(self, axis):
     axis.set_major_locator(AutoLocator())
     axis.set_major_formatter(ScalarFormatter())
     axis.set_minor_locator(NullLocator())
     axis.set_minor_formatter(NullFormatter())