SLIDE 5: Bar Chart: Data Series Colors, majorUnits, and valAxisLabelFormatCode ------
1672
function slide5() {
		var slide = pptx.addNewSlide();
		slide.addNotes('API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-charts.html');
		slide.addTable( [ [{ text:'Chart Examples: Multi-Color Bars, `catLabelFormatCode`, `valAxisMajorUnit`, `valAxisLabelFormatCode`', options:gOptsTextL },gOptsTextR] ], gOptsTabOpts );

		// TOP-LEFT
		slide.addChart(
			pptx.charts.BAR,
			[
				{
					name  : 'Labels are Excel Date Values',
					labels: [37987,38018,38047,38078,38108,38139],
					values: [20, 30, 10, 25, 15, 5]
				}
			],
			{
				x:0.5, y:0.6, w:'45%', h:3,
				barDir: 'bar',
				chartColors: ['0077BF','4E9D2D','ECAA00','5FC4E3','DE4216','154384'],
				catLabelFormatCode: "yyyy-mm",
				valAxisMajorUnit: 15,
				valAxisMaxVal: 45,
				showTitle: true,
				titleFontSize: 14,
				titleColor: '0088CC',
				title: 'Bar Charts Can Be Multi-Color'
			}
		);

		// TOP-RIGHT
		// NOTE: Labels are ppt/excel dates (days past 1900)
		slide.addChart(
			pptx.charts.BAR,
			[
				{
					name  : 'Too Many Colors Series',
					labels: [37987,38018,38047,38078,38108,38139],
					values: [.20, .30, .10, .25, .15, .05]
				}
			],
			{
				x:7, y:0.6, w:'45%', h:3,
				valAxisMaxVal:1,
				barDir: 'bar',
				catAxisLineShow: false,
				valAxisLineShow: false,
				showValue: true,
				catLabelFormatCode: "mmm-yy",
				dataLabelPosition: 'outEnd',
				dataLabelFormatCode: '#%',
				valAxisLabelFormatCode: '#%',
				valAxisMajorUnit: 0.2,
				chartColors: ['0077BF','4E9D2D','ECAA00','5FC4E3','DE4216','154384', '7D666A','A3C961','EF907B','9BA0A3'],
				barGapWidthPct: 25
			}
		);

		// BOTTOM-LEFT
		slide.addChart(
			pptx.charts.BAR,
			[
				{
					name  : 'Two Color Series',
					labels: ['Jan', 'Feb','Mar', 'Apr', 'May', 'Jun'],
					values: [.20, .30, .10, .25, .15, .05]
				}
			],
			{  x:0.5, y:4.0, w:'45%', h:3,
				barDir: 'bar',
				showValue: true,
				dataLabelPosition: 'outEnd',
				dataLabelFormatCode: '#%',
				valAxisLabelFormatCode: '0.#0',
				chartColors: ['0077BF','4E9D2D','ECAA00'],
				valAxisMaxVal: .40,
				barGapWidthPct: 50
			}
		);

		// BOTTOM-RIGHT
		slide.addChart(
			pptx.charts.BAR,
			[
				{
					name  : 'Escaped XML Chars',
					labels: ['Es', 'cap', 'ed', 'XML', 'Chars', "'", '"', '&', '<', '>'],
					values: [1.20, 2.30, 3.10, 4.25, 2.15, 6.05, 8.01, 2.02, 9.9, 0.9]
				}
			],
			{
				x:7, y:4, w:'45%', h:3,
				barDir: 'bar',
				showValue: true,
				dataLabelPosition: 'outEnd',
				chartColors: ['0077BF','4E9D2D','ECAA00','5FC4E3','DE4216','154384','7D666A','A3C961','EF907B','9BA0A3'],
				barGapWidthPct: 25,
				catAxisOrientation: 'maxMin',
				valAxisOrientation: 'maxMin',
				valAxisMaxVal: 10,
				valAxisMajorUnit: 1
			}
		);
	}
26367
def _get_chart_info(df, vtype, cat, prep, callers):
    
    maxval_raw = max(list(df["value.floor"]))
    curdf = df[(df["variant.type"] == vtype) & (df["category"] == cat)
               & (df["bamprep"] == prep)]
    vals = []
    labels = []
    for c in callers:
        row = curdf[df["caller"] == c]
        if len(row) > 0:
            vals.append(list(row["value.floor"])[0])
            labels.append(list(row["value"])[0])
        else:
            vals.append(1)
            labels.append("")
    return vals, labels, maxval_raw
871679
@SuppressWarnings("deprecation")
	private JFreeChart createChart(CategoryDataset dataset) {

//		String s = name;
		String s = null;
		String tit = null;
		String ax = null;
//		if (first)
//			tit = title + " (EST)";
//		else if (last)
//			ax = "Time";

		tit = this.name;
		
        chart = ChartFactory.createStackedBarChart(
            tit,  // chart title
            s,                  // domain axis label
            ax,                     // range axis label
            dataset,                     // data
            PlotOrientation.HORIZONTAL,    // the plot orientation
            false,                        // legend
            false,                       // tooltips
            false                        // urls
        );
        CategoryPlot plot = chart.getCategoryPlot();

        chart.getTitle().setHorizontalAlignment(HorizontalAlignment.LEFT);
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

        //plot.getCategories();
        //CategoryItemRenderer renderer = plot.getRenderer();
        StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
        renderer.setItemLabelsVisible(true);
        renderer.setItemLabelGenerator(new LabelGenerator(showlabels));
        ItemLabelPosition pos = new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.TOP_RIGHT);
    	renderer.setPositiveItemLabelPositionFallback(pos);
        for(int i = 0; i < dataset.getRowCount(); i++) {
        	renderer.setSeriesPositiveItemLabelPosition(i, pos);
        }
        
        /*
        if (values.elementAt(0) instanceof ResourceLevel) {
        	renderer.setItemLabelGenerator( new PlotBoxTL.LabelGenerator(true));
        }
        else
        	renderer.setItemLabelGenerator( new PlotBoxTL.LabelGenerator(false));
        */
        renderer.setToolTipGenerator(new PlotBoxTooltip());
        plot.setRenderer(renderer);
       // renderer.getSeriesStroke(0).
        plot.setForegroundAlpha(0.8f);
                        
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        rangeAxis.setLowerMargin(2.0);
        rangeAxis.setUpperMargin(2.0);
        
        //long origin = stl.getSerializableSimpleTimeline().getEarliestStartTime();
        //long horizon = stl.getSerializableSimpleTimeline().getLatestEndTime();
        long origin = stl.getPulses()[0].longValue();
        NumberFormat nf = new DecimalFormat();
        rangeAxis.setNumberFormatOverride ( nf ); 
        if (this.range != null) rangeAxis.setRange(range);
        //rangeAxis.setRange((new Double(origin)).doubleValue(), (new Double(horizon)).doubleValue());
   
        ///// 0 should be replaced by the start of the horizon
        renderer.setBase(origin);
        
        //renderer.setBase();
        
        

        for (int i = 0; i < durations.length; i++) {
	        if (stl.isInconsistent(values[i]))
	        	renderer.setSeriesPaint(i, new Color(198, 30, 69));
	        else if (stl.isCritical(values[i]))
	        		renderer.setSeriesPaint(i, new Color(238,234,111));
	        else if (stl.isUndetermined(values[i]))
        		renderer.setSeriesPaint(i, new Color(255,255,255));
        	else renderer.setSeriesPaint(i, new Color(111,180,238));
        	renderer.setSeriesOutlinePaint(i, Color.black);
		}
        
        renderer.setBaseSeriesVisibleInLegend(false, false);
        
        renderer.setSeriesStroke(0, new BasicStroke(40f));
        
        return chart;
	}
1196496
function () {
		var defaultSymbols = this.chart.options.symbols,
			counters = this.chart.counters;
		this.symbol = this.options.marker.symbol || defaultSymbols[counters.symbol++];
		counters.wrapSymbol(defaultSymbols.length);
	}
986630
function () {
            var series = this,
              chart = series.chart,
              options = series.options,
              borderWidth = series.borderWidth = pick(
                options.borderWidth,
                series.activePointCount > 0.5 * series.xAxis.len ? 0 : 1
              ),
              yAxis = series.yAxis,
              threshold = options.threshold,
              translatedThreshold = series.translatedThreshold = yAxis.getThreshold(threshold),
              minPointLength = pick(options.minPointLength, 5),
              metrics = series.getColumnMetrics(),
              pointWidth = metrics.width,
              seriesBarW = series.barW = mathMax(pointWidth, 1 + 2 * borderWidth), // postprocessed for border width
              pointXOffset = series.pointXOffset = metrics.offset,
              xCrisp = -(borderWidth % 2 ? 0.5 : 0),
              yCrisp = borderWidth % 2 ? 0.5 : 1;

            if (chart.renderer.isVML && chart.inverted) {
                yCrisp += 1;
            }

            // When the pointPadding is 0, we want the columns to be packed tightly, so we allow individual
            // columns to have individual sizes. When pointPadding is greater, we strive for equal-width
            // columns (#2694).
            if (options.pointPadding) {
                seriesBarW = mathCeil(seriesBarW);
            }

            Series.prototype.translate.apply(series);

            // Record the new values
            each(series.points, function (point) {
                var yBottom = pick(point.yBottom, translatedThreshold),
                  plotY = mathMin(mathMax(-999 - yBottom, point.plotY), yAxis.len + 999 + yBottom), // Don't draw too far outside plot area (#1303, #2241)
                  barX = point.plotX + pointXOffset,
                  barW = seriesBarW,
                  barY = mathMin(plotY, yBottom),
                  right,
                  bottom,
                  fromTop,
                  barH = mathMax(plotY, yBottom) - barY;

                // Handle options.minPointLength
                if (mathAbs(barH) < minPointLength) {
                    if (minPointLength) {
                        barH = minPointLength;
                        barY =
                          mathRound(mathAbs(barY - translatedThreshold) > minPointLength ? // stacked
                          yBottom - minPointLength : // keep position
                          translatedThreshold - (yAxis.translate(point.y, 0, 1, 0, 1) <= translatedThreshold ? minPointLength : 0)); // use exact yAxis.translation (#1485)
                    }
                }

                // Cache for access in polar
                point.barX = barX;
                point.pointWidth = pointWidth;

                // Fix the tooltip on center of grouped columns (#1216, #424)
                point.tooltipPos = chart.inverted ?
                  [yAxis.len - plotY, series.xAxis.len - barX - barW / 2] :
                  [barX + barW / 2, plotY + yAxis.pos - chart.plotTop];

                // Round off to obtain crisp edges and avoid overlapping with neighbours (#2694)
                right = mathRound(barX + barW) + xCrisp;
                barX = mathRound(barX) + xCrisp;
                barW = right - barX;

                fromTop = mathAbs(barY) < 0.5;
                bottom = mathRound(barY + barH) + yCrisp;
                barY = mathRound(barY) + yCrisp;
                barH = bottom - barY;

                // Top edges are exceptions
                if (fromTop) {
                    barY -= 1;
                    barH += 1;
                }

                // Register shape type and arguments to be used in drawPoints
                point.shapeType = 'rect';
                point.shapeArgs = {
                    x: barX,
                    y: barY,
                    width: barW,
                    height: barH
                };

            });

        }
835471
function (chart) {
			var series = this,
				valueDecimals = chart.options.legend.valueDecimals,
				legendItems = [],
				name,
				from,
				to,
				fromLabel,
				toLabel,
				colorRange,
				valueRanges,
				gradientColor,
				grad,
				tmpLabel,
				horizontal = chart.options.legend.layout === 'horizontal';

			
			Highcharts.Series.prototype.init.apply(this, arguments);
			colorRange = series.options.colorRange;
			valueRanges = series.options.valueRanges;

			if (valueRanges) {
				each(valueRanges, function (range) {
					from = range.from;
					to = range.to;
					
					// Assemble the default name. This can be overridden by legend.options.labelFormatter
					name = '';
					if (from === UNDEFINED) {
						name = '< ';
					} else if (to === UNDEFINED) {
						name = '> ';
					}
					if (from !== UNDEFINED) {
						name += numberFormat(from, valueDecimals);
					}
					if (from !== UNDEFINED && to !== UNDEFINED) {
						name += ' - ';
					}
					if (to !== UNDEFINED) {
						name += numberFormat(to, valueDecimals);
					}
					
					// Add a mock object to the legend items
					legendItems.push(Highcharts.extend({
						chart: series.chart,
						name: name,
						options: {},
						drawLegendSymbol: seriesTypes.area.prototype.drawLegendSymbol,
						visible: true,
						setState: function () {},
						setVisible: function () {}
					}, range));
				});
				series.legendItems = legendItems;

			} else if (colorRange) {

				from = colorRange.from;
				to = colorRange.to;
				fromLabel = colorRange.fromLabel;
				toLabel = colorRange.toLabel;

				// Flips linearGradient variables and label text.
				grad = horizontal ? [0, 0, 1, 0] : [0, 1, 0, 0]; 
				if (!horizontal) {
					tmpLabel = fromLabel;
					fromLabel = toLabel;
					toLabel = tmpLabel;
				} 

				// Creates color gradient.
				gradientColor = {
					linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
					stops: 
					[
						[0, from],
						[1, to]
					]
				};

				// Add a mock object to the legend items.
				legendItems = [{
					chart: series.chart,
					options: {},
					fromLabel: fromLabel,
					toLabel: toLabel,
					color: gradientColor,
					drawLegendSymbol: this.drawLegendSymbolGradient,
					visible: true,
					setState: function () {},
					setVisible: function () {}
				}];

				series.legendItems = legendItems;
			}
		}
680269
function (d, chart, series) {
            var stroke = 0;
            if (series.c !== null && series.c !== undefined) {
                stroke = d.stroke;
            } else {
                stroke = chart.getColor(d.aggField.slice(-1)[0]).stroke;
            }
            return stroke;
        }
267966
function(datasetIndex) {
			var barIndex = 0;
			var meta, j;

			for (j = 0; j < datasetIndex; ++j) {
				meta = this.chart.getDatasetMeta(j);
				if (meta.bar && this.chart.isDatasetVisible(j)) {
					++barIndex;
				}
			}

			return barIndex;
		}
156967
def horiz_rows(labels, data, normal_dat, args, colors):
    """"""
    val_min = find_min(data)

    for i in range(len(labels)):
        if args['no_labels']:
            # Hide the labels.
            label = ''
        else:
            label = "{:<{x}}: ".format(labels[i],
                                       x=find_max_label_length(labels))

        values = data[i]
        num_blocks = normal_dat[i]

        for j in range(len(values)):
            # In Multiple series graph 1st category has label at the beginning,
            # whereas the rest categories have only spaces.
            if j > 0:
                len_label = len(label)
                label = ' ' * len_label
            tail = ' {}{}'.format(args['format'].format(values[j]),
                                  args['suffix'])
            if colors:
                color = colors[j]
            else:
                color = None

            if not args['vertical']:
                print(label, end="")

            yield(values[j], int(num_blocks[j]), val_min, color)

            if not args['vertical']:
                print(tail)
1290205
function(data){
			this.segments = [];
			//Declare segment class as a chart instance specific class, so it can share props for this instance
			this.SegmentArc = Chart.Arc.extend({
				showStroke : this.options.segmentShowStroke,
				strokeWidth : this.options.segmentStrokeWidth,
				strokeColor : this.options.segmentStrokeColor,
				ctx : this.chart.ctx,
				innerRadius : 0,
				x : this.chart.width/2,
				y : this.chart.height/2
			});
			this.scale = new Chart.RadialScale({
				display: this.options.showScale,
				fontStyle: this.options.scaleFontStyle,
				fontSize: this.options.scaleFontSize,
				fontFamily: this.options.scaleFontFamily,
				fontColor: this.options.scaleFontColor,
				showLabels: this.options.scaleShowLabels,
				showLabelBackdrop: this.options.scaleShowLabelBackdrop,
				backdropColor: this.options.scaleBackdropColor,
				backdropPaddingY : this.options.scaleBackdropPaddingY,
				backdropPaddingX: this.options.scaleBackdropPaddingX,
				lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
				lineColor: this.options.scaleLineColor,
				lineArc: true,
				width: this.chart.width,
				height: this.chart.height,
				xCenter: this.chart.width/2,
				yCenter: this.chart.height/2,
				ctx : this.chart.ctx,
				templateString: this.options.scaleLabel,
				valuesCount: data.length
			});

			this.updateScaleRange(data);

			this.scale.update();

			helpers.each(data,function(segment,index){
				this.addData(segment,index,true);
			},this);

			//Set up tooltip events on the chart
			if (this.options.showTooltips){
				helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
					var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
					helpers.each(this.segments,function(segment){
						segment.restore(["fillColor"]);
					});
					helpers.each(activeSegments,function(activeSegment){
						activeSegment.fillColor = activeSegment.highlightColor;
					});
					this.showTooltip(activeSegments);
				});
			}

			this.render();
		}
585659
function StackedBarChart(opts) {
      var me, _base2, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28;

      me = this;
      StackedBarChart.__super__.constructor.call(this, opts);
      me.styles = (_ref21 = opts.styles) != null ? _ref21 : '';
      me.colors = (_ref22 = opts.colors) != null ? _ref22 : [];
      me.titles = (_ref23 = opts.titles) != null ? _ref23 : ['', '', '', '', ''];
      me.values = (_ref24 = opts.values) != null ? _ref24 : [];
      me.width = (_ref25 = opts.width) != null ? _ref25 : 17;
      me.height = (_ref26 = opts.height) != null ? _ref26 : 30;
      me["class"] = (_ref27 = opts["class"]) != null ? _ref27 : 'barchart';
      if ((_ref28 = (_base2 = Raphael.fn).drawStackedBarChart) == null) {
        _base2.drawStackedBarChart = drawStackedBars;
      }
    }
832630
function slide9() {
		var intWgap = 4.25;
		var opts_lineDataSymbol = ['circle','dash','diamond','dot','none','square','triangle'];
		var slide = pptx.addNewSlide();
		slide.addNotes('API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-charts.html');
		slide.addTable( [ [{ text:'Chart Examples: Line Chart: lineDataSymbol option test', options:gOptsTextL },gOptsTextR] ], gOptsTabOpts );

		opts_lineDataSymbol.forEach(function(opt,idx){
			slide.addChart(
				pptx.charts.LINE,
				arrDataLineStat,
				{
					x:(idx < 3 ? idx*intWgap : (idx < 6 ? (idx-3)*intWgap : (idx-6)*intWgap)), y:(idx < 3 ? 0.5 : (idx < 6 ? 2.75 : 5)),
					w:4.25, h:2.25,
					lineDataSymbol:opt, title:opt, showTitle:true,
					lineDataSymbolSize:(idx==5 ? 9 : (idx==6 ? 12 : null))
				}
			);
		});
	}
114125
function (series, options, x) {

		var point = this,
			colors;
		point.series = series;
		point.applyOptions(options, x);
		point.pointAttr = {};

		if (series.options.colorByPoint) {
			colors = series.options.colors || series.chart.options.colors;
			point.color = point.color || colors[series.colorCounter++];
			// loop back to zero
			if (series.colorCounter === colors.length) {
				series.colorCounter = 0;
			}
		}

		series.chart.pointCount++;
		return point;
	}
505643
function slide12() {
		var slide = pptx.addNewSlide();
		slide.addNotes('API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-charts.html');
		slide.addTable( [ [{ text:'Chart Examples: Pie Charts: Legends', options:gOptsTextL },gOptsTextR] ], gOptsTabOpts );

		// INTERNAL USE: Not visible to user (its behind a chart): Used for ensuring ref counting works across obj types (eg: `rId` check/test)
		if (NODEJS) slide.addImage({ path:(NODEJS ? gPaths.ccCopyRemix.path.replace(/http.+\/examples/, '../examples') : gPaths.ccCopyRemix.path), x:0.5, y:1.0, w:1.2, h:1.2 });

		// TOP-LEFT
		slide.addText( '.', {x:0.5, y:0.5, w:4.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		slide.addChart(
			pptx.charts.PIE, dataChartPieStat,
			{x:0.5, y:0.5, w:4.2, h:3.2, showLegend:true, legendPos:'l', legendFontFace:'Courier New'}
		);

		// TOP-RIGHT
		slide.addText( '.', {x:5.6, y:0.5, w:3.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		slide.addChart( pptx.charts.PIE, dataChartPieStat, {x:5.6, y:0.5, w:3.2, h:3.2, showLegend:true, legendPos:'t'} );

		// BTM-LEFT
		slide.addText( '.', {x:0.5, y:4.0, w:4.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		slide.addChart( pptx.charts.PIE, dataChartPieLocs, {x:0.5, y:4.0, w:4.2, h:3.2, showLegend:true, legendPos:'r'} );

		// BTM-RIGHT
		slide.addText( '.', {x:5.6, y:4.0, w:3.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		slide.addChart( pptx.charts.PIE, dataChartPieLocs, {x:5.6, y:4.0, w:3.2, h:3.2, showLegend:true, legendPos:'b'} );

		// BOTH: TOP-RIGHT
		slide.addText( '.', {x:9.8, y:0.5, w:3.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		// DEMO: `legendFontSize`, `titleAlign`, `titlePos`
		slide.addChart( pptx.charts.PIE, dataChartPieLocs,
		{
			x:9.8, y:0.5, w:3.2, h:3.2, dataBorder:{pt:'1',color:'F1F1F1'},
			showLegend: true,
			legendPos: 't',
			showTitle: true,
			title:'Left Title & Large Legend',

			legendFontSize: 14,
			titleAlign: 'left',
			titlePos: {x: 0, y: 0}
		});

		// BOTH: BTM-RIGHT
		slide.addText( '.', {x:9.8, y:4.0, w:3.2, h:3.2, fill:'F1F1F1', color:'F1F1F1'} );
		slide.addChart( pptx.charts.PIE, dataChartPieLocs, {x:9.8, y:4.0, w:3.2, h:3.2, dataBorder:{pt:'1',color:'F1F1F1'}, showLegend:true, legendPos:'b', showTitle:true, title:'Title & Legend'} );
	}
343956
private void drawAxisBars(Graphics2D chartGraphics) {
    if (axisThickness > 0) {
      chartGraphics.setColor(axisColour);

      // Draw x-axis.
      int x = heatMapTL.x - axisThickness;
      int y = heatMapBR.y;
      int width = heatMapSize.width + axisThickness;
      int height = axisThickness;
      chartGraphics.fillRect(x, y, width, height);

      // Draw y-axis.
      x = heatMapTL.x - axisThickness;
      y = heatMapTL.y;
      width = axisThickness;
      height = heatMapSize.height;
      chartGraphics.fillRect(x, y, width, height);
    }
  }
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)
704054
function (vis) {
		var point = this,
			series = point.series,
			chart = series.chart,
			method;

		// if called without an argument, toggle visibility
		point.visible = point.options.visible = vis = vis === UNDEFINED ? !point.visible : vis;
		series.options.data[inArray(point, series.data)] = point.options; // update userOptions.data
		
		method = vis ? 'show' : 'hide';

		// Show and hide associated elements
		each(['graphic', 'dataLabel', 'connector', 'shadowGroup'], function (key) {
			if (point[key]) {
				point[key][method]();
			}
		});

		if (point.legendItem) {
			chart.legend.colorizeItem(point, vis);
		}
		
		// Handle ignore hidden slices
		if (!series.isDirty && series.options.ignoreHiddenPoint) {
			series.isDirty = true;
			chart.redraw();
		}
	}