Apply selections on first and second axes.
775141
def subset(data, sel0, sel1):
    """"""

    # check inputs
    data = np.asarray(data)
    if data.ndim < 2:
        raise ValueError('data must have 2 or more dimensions')
    sel0 = asarray_ndim(sel0, 1, allow_none=True)
    sel1 = asarray_ndim(sel1, 1, allow_none=True)

    # ensure indices
    if sel0 is not None and sel0.dtype.kind == 'b':
        sel0, = np.nonzero(sel0)
    if sel1 is not None and sel1.dtype.kind == 'b':
        sel1, = np.nonzero(sel1)

    # ensure leading dimension indices can be broadcast correctly
    if sel0 is not None and sel1 is not None:
        sel0 = sel0[:, np.newaxis]

    # deal with None arguments
    if sel0 is None:
        sel0 = _total_slice
    if sel1 is None:
        sel1 = _total_slice

    return data[sel0, sel1]
58540
def clean_axis(axis):
    """"""
    axis.get_xaxis().set_ticks([])
    axis.get_yaxis().set_ticks([])
    for spine in list(axis.spines.values()):
        spine.set_visible(False)
480595
public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) {
		for (int i = firstIndex; i <= lastIndex; i++)
			map[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2);
	}
1162485
def axes(value):
        
        for i, entry in enumerate(value):
            _assert_is_type('axes[{0}]'.format(i), entry, Axis)
1234655
def OnSelectAll(self, event):
        """"""

        entry_line = \
            self.main_window.entry_line_panel.entry_line_panel.entry_line

        if wx.Window.FindFocus() != entry_line:
            self.main_window.grid.SelectAll()

        else:
            entry_line.SelectAll()
1170177
def _handleSelectAllAxes(self, evt):
        """"""
        if len(self._axisId) == 0:
            return
        for i in range(len(self._axisId)):
            self._menu.Check(self._axisId[i], True)
        self._toolbar.set_active(self.getActiveAxes())
        evt.Skip()
1034441
def grid_select(self, grid, clear_selection=True):
        """"""

        if clear_selection:
            grid.ClearSelection()

        for (tl, br) in zip(self.block_tl, self.block_br):
            grid.SelectBlock(tl[0], tl[1], br[0], br[1], addToSelected=True)

        for row in self.rows:
            grid.SelectRow(row, addToSelected=True)

        for col in self.cols:
            grid.SelectCol(col, addToSelected=True)

        for cell in self.cells:
            grid.SelectBlock(cell[0], cell[1], cell[0], cell[1],
                             addToSelected=True)
860110
def _handleInvertAxesSelected(self, evt):
        """"""
        if len(self._axisId) == 0: return
        for i in range(len(self._axisId)):
            if self._menu.IsChecked(self._axisId[i]):
                self._menu.Check(self._axisId[i], False)
            else:
                self._menu.Check(self._axisId[i], True)
        self._toolbar.set_active(self.getActiveAxes())
        evt.Skip()
765081
def set_xylims(self, limits, axes=None):
        
        if self.panel is not None:
            self.panel.set_xylims(limits, axes=axes)
448660
def update_handles(self, key, axis, element, ranges, style):
        
        self.teardown_handles()
        plot_data, plot_kwargs, axis_kwargs = self.get_data(element, ranges, style)

        with abbreviated_exception():
            handles = self.init_artists(axis, plot_data, plot_kwargs)
        self.handles.update(handles)
        return axis_kwargs
1020920
def setup_axes(
        ax=None,
        panels='blue',
        colorbars=[False],
        right_margin=None,
        left_margin=None,
        projection='2d',
        show_ticks=False):
    
    if '3d' in projection: from mpl_toolkits.mplot3d import Axes3D
    avail_projections = {'2d', '3d'}
    if projection not in avail_projections:
        raise ValueError('choose projection from', avail_projections)
    if left_margin is not None:
        raise ValueError('Currently not supporting to pass `left_margin`.')
    if np.any(colorbars) and right_margin is None:
        right_margin = 1 - rcParams['figure.subplot.right'] + 0.21  # 0.25
    elif right_margin is None:
        right_margin = 1 - rcParams['figure.subplot.right'] + 0.06  # 0.10
    # make a list of right margins for each panel
    if not isinstance(right_margin, list):
        right_margin_list = [right_margin for i in range(len(panels))]
    else:
        right_margin_list = right_margin

    # make a figure with len(panels) panels in a row side by side
    top_offset = 1 - rcParams['figure.subplot.top']
    bottom_offset = 0.15 if show_ticks else 0.08
    left_offset = 1 if show_ticks else 0.3  # in units of base_height
    base_height = rcParams['figure.figsize'][1]
    height = base_height
    base_width = rcParams['figure.figsize'][0]
    if show_ticks: base_width *= 1.1

    draw_region_width = base_width - left_offset - top_offset - 0.5  # this is kept constant throughout

    right_margin_factor = sum([1 + right_margin for right_margin in right_margin_list])
    width_without_offsets = right_margin_factor * draw_region_width  # this is the total width that keeps draw_region_width

    right_offset = (len(panels) - 1) * left_offset
    figure_width = width_without_offsets + left_offset + right_offset
    draw_region_width_frac = draw_region_width / figure_width
    left_offset_frac = left_offset / figure_width
    right_offset_frac = 1 - (len(panels) - 1) * left_offset_frac

    if ax is None:
        pl.figure(figsize=(figure_width, height),
                  subplotpars=sppars(left=0, right=1, bottom=bottom_offset))
    left_positions = [left_offset_frac, left_offset_frac + draw_region_width_frac]
    for i in range(1, len(panels)):
        right_margin = right_margin_list[i-1]
        left_positions.append(left_positions[-1] + right_margin * draw_region_width_frac)
        left_positions.append(left_positions[-1] + draw_region_width_frac)
    panel_pos = [[bottom_offset], [1-top_offset], left_positions]

    axs = []
    if ax is None:
        for icolor, color in enumerate(panels):
            left = panel_pos[2][2*icolor]
            bottom = panel_pos[0][0]
            width = draw_region_width / figure_width
            height = panel_pos[1][0] - bottom
            if projection == '2d': ax = pl.axes([left, bottom, width, height])
            elif projection == '3d': ax = pl.axes([left, bottom, width, height], projection='3d')
            axs.append(ax)
    else:
        axs = ax if isinstance(ax, list) else [ax]

    return axs, panel_pos, draw_region_width, figure_width
1353259
function selectionSet (elem) {
  const sel = document.getSelection()
  const range = document.createRange()
  range.selectNodeContents(elem)
  sel.removeAllRanges()
  sel.addRange(range)
}
1054126
def _reindex_multi(self, axes, copy, fill_value):
        

        new_index, row_indexer = self.index.reindex(axes['index'])
        new_columns, col_indexer = self.columns.reindex(axes['columns'])

        if row_indexer is not None and col_indexer is not None:
            indexer = row_indexer, col_indexer
            new_values = algorithms.take_2d_multi(self.values, indexer,
                                                  fill_value=fill_value)
            return self._constructor(new_values, index=new_index,
                                     columns=new_columns)
        else:
            return self._reindex_with_indexers({0: [new_index, row_indexer],
                                                1: [new_columns, col_indexer]},
                                               copy=copy,
                                               fill_value=fill_value)
168875
def selection(self):
        """"""
        sel = QtGui.QItemSelection()
        for index in self.selectedIndexes():
            sel.select(index, index)
        return sel
99911
function exports(_selection) {
            _selection.each(function(_data) {
                chartWidth = width - margin.left - margin.right - (yAxisPaddingBetweenChart * 1.2);
                chartHeight = height - margin.top - margin.bottom;
                ({data, dataZeroed} = sortData(cleanData(_data)));

                buildScales();
                buildAxis();
                buildSVG(this);
                buildGradient();
                drawGridLines();
                drawBars();
                drawAxis();

                if (enableLabels) {
                    drawLabels();
                }
            });
        }
1306722
def switch_axis_limits(ax, which_axis):
    '''
    
    '''
    for a in which_axis:
        assert a in ('x', 'y')
        ax_limits = ax.axis()
        if a == 'x':
            ax.set_xlim(ax_limits[1], ax_limits[0])
        else:
            ax.set_ylim(ax_limits[3], ax_limits[2])
1086914
def apply_plot_params(plot_params,ax):
    """"""
    
    import matplotlib.pyplot as plt

    if plot_params['xlim'] is not None: 
        ax.set_xlim(plot_params['xlim'])
        
        if plot_params['reverse_x'] and plot_params['xlim'][0] < plot_params['xlim'][1]:
            ax.invert_xaxis()            
            
    elif plot_params['reverse_x']:
        ax.invert_xaxis()
    
    if plot_params['ylim'] is not None: ax.set_ylim(plot_params['ylim'])
        
    ax.grid(plot_params['grid'])
    ax.set_title(plot_params['title'],fontsize=plot_params['fontsize'],y=1.02)
    ax.set_xlabel(plot_params['xlabel'],fontsize=plot_params['tick_fontsize'])
    ax.set_ylabel(plot_params['ylabel'],fontsize=plot_params['tick_fontsize'])
    ax.set_axis_bgcolor(plot_params['axis_bg_color'])
    
    # Apply some properties to the line(s)
    line_handles = ax.get_lines()
    plt.setp(line_handles, lw=plot_params['line_width'], ls=plot_params['line_style'],
             marker=plot_params['marker'])
    
    if plot_params['line_color'] is not 'default':
        plt.setp(line_handles,'color', plot_params['line_color'])

    
    # Autoscale data on the y-axis to reflect changes to the x-axis
    if plot_params['autoscale_y']:
        ax = autoscale_y(ax,margin=0.05)
    
    if plot_params['use_sci_format_yaxis']:
        # Use scientific notation for the y-axis labels
        ax.ticklabel_format(axis='y',style='sci',scilimits=(-2,2))
    
    if plot_params['use_sci_format_xaxis']:
        # Use scientific notation for the x-axis labels
        ax.ticklabel_format(axis='x',style='sci',scilimits=(-2,2))
    
    ax.tick_params(labelsize=plot_params['tick_fontsize'])
        
    return ax