make all of the subplots have the same limits, turn off unnecessary ticks
339091
def align_subplots(N,M,xlim=None, ylim=None):
    """"""
    #find sensible xlim,ylim
    if xlim is None:
        xlim = [np.inf,-np.inf]
        for i in range(N*M):
            plt.subplot(N,M,i+1)
            xlim[0] = min(xlim[0],plt.xlim()[0])
            xlim[1] = max(xlim[1],plt.xlim()[1])
    if ylim is None:
        ylim = [np.inf,-np.inf]
        for i in range(N*M):
            plt.subplot(N,M,i+1)
            ylim[0] = min(ylim[0],plt.ylim()[0])
            ylim[1] = max(ylim[1],plt.ylim()[1])

    for i in range(N*M):
        plt.subplot(N,M,i+1)
        plt.xlim(xlim)
        plt.ylim(ylim)
        if (i)%M:
            plt.yticks([])
        else:
            removeRightTicks()
        if i<(M*(N-1)):
            plt.xticks([])
        else:
            removeUpperTicks()
924127
def subplots(scale_x=None, scale_y=None, scale=None, **kwargs):
  
  '''

  if 'figsize' in kwargs: return plt.subplots(**kwargs)

  width, height = mpl.rcParams['figure.figsize']

  if scale is not None:
    width  *= scale
    height *= scale

  if scale_x is not None:
    width *= scale_x

  if scale_y is not None:
    height *= scale_y

  nrows = kwargs.pop('nrows', 1)
  ncols = kwargs.pop('ncols', 1)

  width  = ncols * width
  height = nrows * height

  return plt.subplots(nrows=nrows, ncols=ncols, figsize=(width,height), **kwargs)
149605
def widen(self):
        """"""
        t, h = self.time, self.half_duration
        h *= self.scaling_coeff_x
        self.set_interval((t - h, t + h))
629869
def set_xlimits(self, row, column, min=None, max=None):
        
        subplot = self.get_subplot_at(row, column)
        subplot.set_xlimits(min, max)
149142
def _set_axis_limits(self, axis, view, subplots, ranges):
        
        # Extents
        extents = self.get_extents(view, ranges)
        if not extents or self.overlaid:
            axis.autoscale_view(scalex=True, scaley=True)
            return

        valid_lim = lambda c: util.isnumeric(c) and not np.isnan(c)
        coords = [coord if np.isreal(coord) or isinstance(coord, np.datetime64) else np.NaN for coord in extents]
        coords = [date2num(util.dt64_to_dt(c)) if isinstance(c, np.datetime64) else c
                  for c in coords]
        if self.projection == '3d' or len(extents) == 6:
            l, b, zmin, r, t, zmax = coords
            if self.invert_zaxis or any(p.invert_zaxis for p in subplots):
                zmin, zmax = zmax, zmin
            if zmin != zmax:
                if valid_lim(zmin):
                    axis.set_zlim(bottom=zmin)
                if valid_lim(zmax):
                    axis.set_zlim(top=zmax)
        else:
            l, b, r, t = coords

        if self.invert_axes:
            l, b, r, t = b, l, t, r

        invertx = self.invert_xaxis or any(p.invert_xaxis for p in subplots)
        xlim, scalex = self._compute_limits(l, r, self.logx, invertx, 'left', 'right')
        inverty = self.invert_yaxis or any(p.invert_yaxis for p in subplots)
        ylim, scaley =  self._compute_limits(b, t, self.logy, inverty, 'bottom', 'top')
        if xlim:
            axis.set_xlim(**xlim)
        if ylim:
            axis.set_ylim(**ylim)
        axis.autoscale_view(scalex=scalex, scaley=scaley)
19238
function () {
            var axis = this,
              chart = axis.chart,
              key = axis._maxTicksKey,
              tickPositions = axis.tickPositions,
              maxTicks = chart.maxTicks;

            if (maxTicks && maxTicks[key] && !axis.isDatetimeAxis && !axis.categories && !axis.isLinked &&
              axis.options.alignTicks !== false && this.min !== UNDEFINED) {
                var oldTickAmount = axis.tickAmount,
                  calculatedTickAmount = tickPositions.length,
                  tickAmount;

                // set the axis-level tickAmount to use below
                axis.tickAmount = tickAmount = maxTicks[key];

                if (calculatedTickAmount < tickAmount) {
                    while (tickPositions.length < tickAmount) {
                        tickPositions.push(correctFloat(
                          tickPositions[tickPositions.length - 1] + axis.tickInterval
                        ));
                    }
                    axis.transA *= (calculatedTickAmount - 1) / (tickAmount - 1);
                    axis.max = tickPositions[tickPositions.length - 1];

                }
                if (defined(oldTickAmount) && tickAmount !== oldTickAmount) {
                    axis.isDirty = true;
                }
            }
        }
1029450
def fix_ticks(ax):
    
    plt.setp(ax.get_yticklabels(), ha='center', x=0.5,
             transform=ax._yaxis_transform)

    # We'll still wind up with some tick labels beyond axes limits for reasons
    # I don't fully understand...
    limits = ax.get_ylim()
    for label, loc in zip(ax.yaxis.get_ticklabels(), ax.yaxis.get_ticklocs()):
        if loc < min(limits) or loc > max(limits):
            label.set(visible=False)
        else:
            label.set(visible=True)
1001583
def plot_two_columns(self, reset_xlimits=False, reset_ylimits=False):
        """"""
        self.clear_plot()

        if self.tab is None:  # No table data to plot
            return

        plt_kw = {
            'lw': self.settings.get('linewidth', 1),
            'ls': self.settings.get('linestyle', '-'),
            'color': self.settings.get('linecolor', 'blue'),
            'ms': self.settings.get('markersize', 6),
            'mew': self.settings.get('markerwidth', 0.5),
            'mfc': self.settings.get('markercolor', 'red')}
        plt_kw['mec'] = plt_kw['mfc']

        try:
            x_data, y_data, marker = self._get_plot_data()

            self.tab_plot.plot(
                x_data, y_data,
                xtitle=self._get_label('x'), ytitle=self._get_label('y'),
                marker=marker, **plt_kw)

            if reset_xlimits:
                self.set_ylim_cb()
                self.set_xlimits_widgets()
            if reset_ylimits:
                self.set_xlim_cb()
                self.set_ylimits_widgets()
            if not (reset_xlimits or reset_ylimits):
                self.set_xlim_cb(redraw=False)
                self.set_ylim_cb()

        except Exception as e:
            self.logger.error(str(e))
        else:
            self.save_plot.set_enabled(True)
645516
def setSr(self, fs):
        """"""
        self.tracePlot.setSr(fs)
        self.stimPlot.setSr(fs)
1015462
def set_xticks(self, row, column, ticks):
        
        subplot = self.get_subplot_at(row, column)
        subplot.set_xticks(ticks)
397685
def _merge_tools(self, subplot):
        
        if self.batched and 'hover' in subplot.handles:
            self.handles['hover'] = subplot.handles['hover']
        elif 'hover' in subplot.handles and 'hover_tools' in self.handles:
            hover = subplot.handles['hover']
            # Datetime formatter may have been applied, remove _dt_strings
            # to match on the hover tooltips, then merge tool renderers
            if hover.tooltips and not isinstance(hover.tooltips, util.basestring):
                tooltips = tuple((name, spec.replace('_dt_strings', ''))
                                  for name, spec in hover.tooltips)
            else:
                tooltips = ()
            tool = self.handles['hover_tools'].get(tooltips)
            if tool:
                tool_renderers = [] if tool.renderers == 'auto' else tool.renderers
                hover_renderers = [] if hover.renderers == 'auto' else hover.renderers
                renderers = tool_renderers + hover_renderers
                tool.renderers = list(util.unique_iterator(renderers))
            if 'hover' not in self.handles:
                self.handles['hover'] = tool
341588
function () {

		var times = this.times,
			values = this.values,
			stride = this.getValueSize(),

			smoothInterpolation = this.getInterpolation() === InterpolateSmooth,

			writeIndex = 1,
			lastIndex = times.length - 1;

		for ( var i = 1; i < lastIndex; ++ i ) {

			var keep = false;

			var time = times[ i ];
			var timeNext = times[ i + 1 ];

			// remove adjacent keyframes scheduled at the same time

			if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) {

				if ( ! smoothInterpolation ) {

					// remove unnecessary keyframes same as their neighbors

					var offset = i * stride,
						offsetP = offset - stride,
						offsetN = offset + stride;

					for ( var j = 0; j !== stride; ++ j ) {

						var value = values[ offset + j ];

						if ( value !== values[ offsetP + j ] ||
							value !== values[ offsetN + j ] ) {

							keep = true;
							break;

						}

					}

				} else {

					keep = true;

				}

			}

			// in-place compaction

			if ( keep ) {

				if ( i !== writeIndex ) {

					times[ writeIndex ] = times[ i ];

					var readOffset = i * stride,
						writeOffset = writeIndex * stride;

					for ( var j = 0; j !== stride; ++ j ) {

						values[ writeOffset + j ] = values[ readOffset + j ];

					}

				}

				++ writeIndex;

			}

		}

		// flush last keyframe (compaction looks ahead)

		if ( lastIndex > 0 ) {

			times[ writeIndex ] = times[ lastIndex ];

			for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {

				values[ writeOffset + j ] = values[ readOffset + j ];

			}

			++ writeIndex;

		}

		if ( writeIndex !== times.length ) {

			this.times = AnimationUtils.arraySlice( times, 0, writeIndex );
			this.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride );

		}

		return this;

	}
424552
private void overrideMinMaxForXAxis() {

    double overrideXAxisMinValue = xAxis.getMin();
    double overrideXAxisMaxValue = xAxis.getMax();
    // override min and maxValue if specified
    if (chart.getStyler().getXAxisMin() != null) {

      overrideXAxisMinValue = chart.getStyler().getXAxisMin();
    }
    if (chart.getStyler().getXAxisMax() != null) {

      overrideXAxisMaxValue = chart.getStyler().getXAxisMax();
    }
    xAxis.setMin(overrideXAxisMinValue);
    xAxis.setMax(overrideXAxisMaxValue);
  }
1178753
def prevPlot(self):
        """"""
        if self.stacker.currentIndex() > 0:
            self.stacker.setCurrentIndex(self.stacker.currentIndex()-1)
771737
def set_xylims(self, limits, axes=None, side='left'):
        ""
        if axes is None:
            axes = self.axes
            if side == 'right':
                axes = self.get_right_axes()
        self.conf.user_limits[axes] = limits
        self.unzoom_all()
1163094
def set(self, **kwargs):
        
        if len(kwargs)==0: return self
        
        # Set settings
        for k in list(kwargs.keys()): self[k] = kwargs[k]
        
        # Plot if we're supposed to.
        if self['autoplot'] and not self._initializing: self.plot()

        return self
1157848
def _create_dynamic_subplots(self, key, items, ranges, **init_kwargs):
        
        length = self.style_grouping
        group_fn = lambda x: (x.type.__name__, x.last.group, x.last.label)
        for i, (k, obj) in enumerate(items):
            vmap = self.hmap.clone([(key, obj)])
            self.map_lengths[group_fn(vmap)[:length]] += 1
            subplot = self._create_subplot(k, vmap, [], ranges)
            if subplot is None:
                continue
            self.subplots[k] = subplot
            subplot.initialize_plot(ranges, **init_kwargs)
            subplot.update_frame(key, ranges, element=obj)
            self.dynamic_subplots.append(subplot)