DEPRECATED: use :meth:`Plot.add_segments_bar`
484780
def add_state_segments(self, *args, **kwargs):
        
        warnings.warn('add_state_segments() was renamed add_segments_bar(), '
                      'this warning will result in an error in the future',
                      DeprecationWarning)
        return self.add_segments_bar(*args, **kwargs)
1312753
def on_bar_data(self, bars):
        """"""
        for tick in XmlHelper.node_iter(bars):
            names = [str(tick.getElement(_).name()) for _ in range(tick.numElements())]
            barmap = {n: XmlHelper.get_child_value(tick, n) for n in names}
            self.response.bars.append(barmap)
1160320
def AddIndex(self, path_segment_index):
    
    if path_segment_index in self._weight_per_index:
      raise ValueError('Path segment index already set.')

    self._weight_per_index[path_segment_index] = 0
17247
def _add_legend_or_colorbar(adata, ax, cax, categorical, value_to_plot, legend_loc,
                            scatter_array, legend_fontweight, legend_fontsize,
                            groups, multi_panel):
    
    # add legends or colorbars
    if categorical is True:
        # add legend to figure
        categories = list(adata.obs[value_to_plot].cat.categories)
        colors = adata.uns[value_to_plot + '_colors']

        if multi_panel is True:
            # Shrink current axis by 10% to fit legend and match
            # size of plots that are not categorical
            box = ax.get_position()
            ax.set_position([box.x0, box.y0, box.width * 0.91, box.height])

        if groups is not None:
            # only label groups with the respective color
            colors = [colors[categories.index(x)] for x in groups]
            categories = groups

        if legend_loc == 'right margin':
            for idx, label in enumerate(categories):
                color = colors[idx]
                # use empty scatter to set labels
                ax.scatter([], [], c=color, label=label)
            ax.legend(
                frameon=False, loc='center left',
                bbox_to_anchor=(1, 0.5),
                ncol=(1 if len(categories) <= 14
                      else 2 if len(categories) <= 30 else 3),
                fontsize=legend_fontsize)

        if legend_loc == 'on data':
            # identify centroids to put labels
            all_pos = np.zeros((len(categories), 2))
            for ilabel, label in enumerate(categories):
                _scatter = scatter_array[adata.obs[value_to_plot] == label, :]
                x_pos, y_pos = np.median(_scatter, axis=0)

                ax.text(x_pos, y_pos, label,
                        weight=legend_fontweight,
                        verticalalignment='center',
                        horizontalalignment='center',
                        fontsize=legend_fontsize)

                all_pos[ilabel] = [x_pos, y_pos]
            # this is temporary storage for access by other tools
            utils._tmp_cluster_pos = all_pos
    else:
        # add colorbar to figure
        pl.colorbar(cax, ax=ax, pad=0.01, fraction=0.08, aspect=30)
1295314
public static String addBorder(String[] segments) {
    assertInitialization();
    return XLog.sLogConfiguration.borderFormatter.format(segments);
  }
1368515
function(segments) {
        var previousSegment = [-1, -1];
        var segmentIndicesToRemove = [];
        var cleanedSegmentArray = [];
        var i, ii;
        for (i = 0, ii = segments.length; i < ii; ++i) {
            if (!(previousSegment[0] <= segments[i][0] &&
                    previousSegment[1] >= segments[i][1])) {
                cleanedSegmentArray.push(segments[i]);
            }
            previousSegment = segments[i];
        }

        segments.length = 0;
        for (i = 0, ii = cleanedSegmentArray.length; i < ii; ++i) {
            segments.push(cleanedSegmentArray[i]);
        }
    }
1009811
def _segment(cls, segment):
        
        return property(
            fget=lambda x: cls._get_segment(x, segment),
            fset=lambda x, v: cls._set_segment(x, segment, v),
        )
476746
def add(self, start, end, cut_point = None, skip_rate = None, extend_loop = None):
        ''''''
        self.data.append(self.parse_loop_line(['LOOP', start, end, cut_point, skip_rate, extend_loop]))
        assert(start <= end)
343780
def add_net_values_to_bar_plot(axs, color='k'):
    
    axs = axs if isinstance(axs, Iterable) else [axs]
    for ax in axs:
        box_args = _get_boxes(ax)
        for x, args in box_args.items():
            rect = mpatches.Rectangle(*args, color=color)
            ax.add_patch(rect)
127867
def __get_segments_from_node(node, graph):
    """"""
    list_of_segments = []
    node_object = graph.get_node(node)
    for e in node_object['edges']:
        list_of_segments.append(e)
    return list_of_segments
1220615
def _removeSegment(self, segment, preserveCurve, **kwargs):
        
        segment = self.segments[segment]
        for point in segment.points:
            self.removePoint(point, preserveCurve)
703299
def _join(segments):
    """"""
    new = []
    start = segments[0][0]
    end = segments[0][1]
    for i in range(len(segments)-1):
        if segments[i+1][0] != segments[i][1]:
            new.append((start, end))
            start = segments[i+1][0]
        end = segments[i+1][1]
    new.append((start, end))
    return new
1067028
private JFreeChart addLineChartOverBar(JFreeChart jfreechart, Object[] lineCharts, String lineLegend) throws QueryException {
		// first we read data for bar series, so we have to go back at the start of the result set
		try {
			result.getResultSet().beforeFirst();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		isLineCombo = true;
		lineBarDataset =  new DefaultCategoryDataset();						
		boolean hasLegend = false;
		for (int i = 0; i < lineCharts.length; i++) {
			String legend = "";
			try {
				legend = replaceParameters(lineLegend);
			} catch (IndexOutOfBoundsException ex){
				// no legend set
			}
			if ((legend != null) && !"".equals(legend.trim())) {
				hasLegend = true;
			}						
			lineCharts[i] = legend;			
		}
									
		int index = chart.getYColumns().size()-1;
		CategoryPlot plot = jfreechart.getCategoryPlot();  		
        final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();       
        plot.setRenderer(1, renderer2);
        renderer2.setSeriesPaint(0, chart.getForegrounds().get(index));
                  		     		     		
	    final ValueAxis axis2 = new NumberAxis("");	    
	    plot.setRangeAxis(1, axis2);
	    plot.setDataset(1, lineBarDataset);
	    plot.mapDatasetToRangeAxis(1, 1);
	    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
	    
	    boolean showValues = (chart.getShowYValuesOnChart() == null) ? false : chart.getShowYValuesOnChart();
 		DecimalFormat decimalFormat;
 		DecimalFormat percentageFormat;
 		if (chart.getYTooltipPattern() == null) {
 			decimalFormat = new DecimalFormat("#");
 			percentageFormat = new DecimalFormat("0.00%");
 		} else {
 			decimalFormat = new DecimalFormat(chart.getYTooltipPattern());
 			percentageFormat = decimalFormat;
 		}
 		if (showValues) {
 			renderer2.setSeriesItemLabelsVisible(0, true); 
 			renderer2.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator("{2}", decimalFormat, percentageFormat));
			// increase a little bit the range axis to view all item label values over points
			plot.getRangeAxis(1).setUpperMargin(0.2);
		}
					                
        final HashMap<String, String> formatValues = createChart(chart.getYColumns().subList(index, index+1), plot.getRangeAxis(1), lineCharts);                        
        
        isLineCombo = false;
        return jfreechart;               
	}
335417
def segment(f, output, target_duration, mpegts):
    """"""
    try:
        target_duration = int(target_duration)
    except ValueError:
        exit('Error: Invalid target duration.')

    try:
        mpegts = int(mpegts)
    except ValueError:
        exit('Error: Invalid MPEGTS value.')

    WebVTTSegmenter().segment(f, output, target_duration, mpegts)
912646
def __tokenize_segments(self):
        
        for seg_node_id in self.segments:
            segment_toks = self.node[seg_node_id][self.ns+':text'].split()
            for i, tok in enumerate(segment_toks):
                tok_node_id = '{0}:{1}_{2}'.format(self.ns, seg_node_id, i)
                self.add_node(tok_node_id, layers={self.ns, self.ns+':token'},
                              attr_dict={self.ns+':token': tok, 'label': tok})
                self.tokens.append(tok_node_id)
                self.add_edge(seg_node_id, tok_node_id,
                              layers={'rst', 'rst:token'},
                              edge_type=EdgeTypes.spanning_relation)
1186029
def _get_segments(self):
        
        points = list(self.points)
        segments = [[]]
        lastWasOffCurve = False
        firstIsMove = points[0].type == "move"
        for point in points:
            segments[-1].append(point)
            if point.type != "offcurve":
                segments.append([])
            lastWasOffCurve = point.type == "offcurve"
        if len(segments[-1]) == 0:
            del segments[-1]
        if lastWasOffCurve and firstIsMove:
            # ignore trailing off curves
            del segments[-1]
        if lastWasOffCurve and not firstIsMove:
            segment = segments.pop(-1)
            segment.extend(segments[0])
            del segments[0]
            segments.append(segment)
        if not lastWasOffCurve and not firstIsMove:
            segment = segments.pop(0)
            segments.append(segment)
        # wrap into segments
        wrapped = []
        for points in segments:
            s = self.segmentClass()
            s._setPoints(points)
            self._setContourInSegment(s)
            wrapped.append(s)
        return wrapped
49800
def bar(h: Histogram2D, *,
        barmode: str = DEFAULT_BARMODE,
        alpha: float = DEFAULT_ALPHA,
        **kwargs):
    
    get_data_kwargs = pop_many(kwargs, "density", "cumulative", "flatten")
    data = [go.Bar(
        x=histogram.bin_centers,
        y=get_data(histogram, **get_data_kwargs),
        width=histogram.bin_widths,
        name=histogram.name,
        opacity=alpha,
        **kwargs
    ) for histogram in h]

    layout = go.Layout(barmode=barmode)

    _add_ticks(layout.xaxis, h[0], kwargs)

    figure = go.Figure(data=data, layout=layout)
    return figure