def __init__(self, data=None, figure=None, axes=None, layer_artist_container=None): """ Create a new ScatterClient object :param data: :class:`~glue.core.data.DataCollection` to use :param figure: Which matplotlib figure instance to draw to. One will be created if not provided :param axes: Which matplotlib axes instance to use. Will be created if necessary """ Client.__init__(self, data=data) figure, axes = init_mpl(figure, axes) self.artists = layer_artist_container if self.artists is None: self.artists = LayerArtistContainer() self._layer_updated = False # debugging self._xset = False self._yset = False self.axes = axes self._connect() self._set_limits()
def __init__(self, data, figure, layer_artist_container=None): super(HistogramClient, self).__init__(data) self._artists = layer_artist_container or LayerArtistContainer() self._figure, self._axes = init_mpl(figure=figure, axes=None) self._component = None self._saved_nbins = None self._xlim_cache = {} self._xlog_cache = {} self._sync_enabled = True self._xlog_curr = False
def _setup_mpl(self, figure, axes): figure, axes = init_mpl(figure, axes, wcs=True) self._axes = axes self._axes.get_xaxis().set_ticks([]) self._axes.get_yaxis().set_ticks([]) self._figure = figure # custom axes formatter def format_coord(x, y): data = self.display_data if data is None: # MPL default method return type(self._axes).format_coord(self._axes, x, y) info = self.point_details(x, y) return ' '.join(info['labels']) self._axes.format_coord = format_coord self._cid = self._axes.figure.canvas.mpl_connect('button_release_event', self.check_update) if hasattr(self._axes.figure.canvas, 'homeButton'): # test code doesn't always use Glue's custom FigureCanvas self._axes.figure.canvas.homeButton.connect(self.check_update)
def _setup_axes(self): from glue.clients.viz_client import init_mpl _, self._axes = init_mpl(self.central_widget.canvas.fig, axes=None, wcs=True) self._axes.set_aspect('equal', adjustable='datalim')