Exemplo n.º 1
0
def init_mpl(figure=None, axes=None, wcs=False, axes_factory=None):

    if (axes is not None and figure is not None and
            axes.figure is not figure):
        raise ValueError("Axes and figure are incompatible")

    try:
        from astropy.visualization.wcsaxes import WCSAxesSubplot
    except ImportError:
        WCSAxesSubplot = None

    if axes is not None:
        _axes = axes
        _figure = axes.figure
    else:
        _figure = figure or plt.figure()
        if wcs and WCSAxesSubplot is not None:
            _axes = WCSAxesSubplot(_figure, 111)
            _figure.add_axes(_axes)
        else:
            if axes_factory is None:
                _axes = _figure.add_subplot(1, 1, 1)
            else:
                _axes = axes_factory(_figure)

    freeze_margins(_axes, margins=[1, 0.25, 0.50, 0.25])

    update_appearance_from_settings(_axes)

    return _figure, _axes
Exemplo n.º 2
0
def init_mpl(figure=None, axes=None, wcs=False, axes_factory=None):

    if (axes is not None and figure is not None and
            axes.figure is not figure):
        raise ValueError("Axes and figure are incompatible")

    try:
        from glue.external.wcsaxes import WCSAxesSubplot
    except ImportError:
        WCSAxesSubplot = None

    if axes is not None:
        _axes = axes
        _figure = axes.figure
    else:
        _figure = figure or plt.figure()
        if wcs and WCSAxesSubplot is not None:
            _axes = WCSAxesSubplot(_figure, 111)
            _figure.add_axes(_axes)
        else:
            if axes_factory is not None:
                _axes = axes_factory(_figure)
            else:
                _axes = _figure.add_subplot(1, 1, 1)

    freeze_margins(_axes, margins=[1, 0.25, 0.50, 0.25])

    return _figure, _axes
Exemplo n.º 3
0
def init_mpl(figure=None, axes=None, wcs=False, axes_factory=None):

    if (axes is not None and figure is not None and axes.figure is not figure):
        raise ValueError("Axes and figure are incompatible")

    try:
        from glue.external.wcsaxes import WCSAxesSubplot
    except ImportError:
        WCSAxesSubplot = None

    if axes is not None:
        _axes = axes
        _figure = axes.figure
    else:
        _figure = figure or plt.figure()
        if wcs and WCSAxesSubplot is not None:
            _axes = WCSAxesSubplot(_figure, 111)
            _figure.add_axes(_axes)
        else:
            if axes_factory is not None:
                _axes = axes_factory(_figure)
            else:
                _axes = _figure.add_subplot(1, 1, 1)

    freeze_margins(_axes, margins=[1, 0.25, 0.50, 0.25])

    return _figure, _axes
Exemplo n.º 4
0
 def _set_pos_and_margin(self, axes, pos, marg):
     axes.set_position(pos)
     freeze_margins(axes, marg)
Exemplo n.º 5
0
 def _set_pos_and_margin(self, axes, pos, marg):
     axes.set_position(pos)
     freeze_margins(axes, marg)