Logo Search packages:      
Sourcecode: matplotlib version File versions

def custom_scale_example::MercatorLatitudeScale::set_default_locators_and_formatters (   self,
  axis 
)

Override to set up the locators and formatters to use with the
scale.  This is only required if the scale requires custom
locators and formatters.  Writing custom locators and
formatters is rather outside the scope of this example, but
there are many helpful examples in ``ticker.py``.

In our case, the Mercator example uses a fixed locator from
-90 to 90 degrees and a custom formatter class to put convert
the radians to degrees and put a degree symbol after the
value::

Definition at line 54 of file custom_scale_example.py.

00054                                                        :
        """
        Override to set up the locators and formatters to use with the
        scale.  This is only required if the scale requires custom
        locators and formatters.  Writing custom locators and
        formatters is rather outside the scope of this example, but
        there are many helpful examples in ``ticker.py``.

        In our case, the Mercator example uses a fixed locator from
        -90 to 90 degrees and a custom formatter class to put convert
        the radians to degrees and put a degree symbol after the
        value::
        """
        class DegreeFormatter(Formatter):
            def __call__(self, x, pos=None):
                # \u00b0 : degree symbol
                return u"%d\u00b0" % ((x / np.pi) * 180.0)

        deg2rad = np.pi / 180.0
        axis.set_major_locator(FixedLocator(
                np.arange(-90, 90, 10) * deg2rad))
        axis.set_major_formatter(DegreeFormatter())
        axis.set_minor_formatter(DegreeFormatter())

    def limit_range_for_scale(self, vmin, vmax, minpos):


Generated by  Doxygen 1.6.0   Back to index