Add a data series to the plot.

        :param phi: array containing phi-values, should be in degrees
                    (or radians).
        :param r: array containing r-values.

        For further options see the plot function of the super class.
170276
def plot(self, phi, r, **kwargs):
        
        if self.use_radians:
            phi = np.degrees(phi)
        super(PolarPlot, self).plot(phi, r, **kwargs)
614453
public CategorySeries addSeries(String seriesName, double[] xData, double[] yData) {

    return addSeries(seriesName, xData, yData, null);
  }
1029508
def _add_series_or_dataframe_operations(cls):
        

        from pandas.core import window as rwindow

        @Appender(rwindow.rolling.__doc__)
        def rolling(self, window, min_periods=None, center=False,
                    win_type=None, on=None, axis=0, closed=None):
            axis = self._get_axis_number(axis)
            return rwindow.rolling(self, window=window,
                                   min_periods=min_periods,
                                   center=center, win_type=win_type,
                                   on=on, axis=axis, closed=closed)

        cls.rolling = rolling

        @Appender(rwindow.expanding.__doc__)
        def expanding(self, min_periods=1, center=False, axis=0):
            axis = self._get_axis_number(axis)
            return rwindow.expanding(self, min_periods=min_periods,
                                     center=center, axis=axis)

        cls.expanding = expanding

        @Appender(rwindow.ewm.__doc__)
        def ewm(self, com=None, span=None, halflife=None, alpha=None,
                min_periods=0, adjust=True, ignore_na=False,
                axis=0):
            axis = self._get_axis_number(axis)
            return rwindow.ewm(self, com=com, span=span, halflife=halflife,
                               alpha=alpha, min_periods=min_periods,
                               adjust=adjust, ignore_na=ignore_na, axis=axis)

        cls.ewm = ewm
262551
private void addChartLinks() {
        add(new UpdateHighchartLink("line"));
        add(new UpdateHighchartLink("splineWithSymbols"));
        add(new UpdateHighchartLink("irregularIntervals"));
        add(new UpdateHighchartLink("logarithmicAxis"));
        add(new UpdateHighchartLink("scatter"));
        add(new UpdateHighchartLink("area"));
        add(new UpdateHighchartLink("areaWithNegativeValues"));
        add(new UpdateHighchartLink("stackedAndGroupedColumn"));
        add(new UpdateHighchartLink("combo"));
        add(new UpdateHighchartLink("donut"));
        add(new UpdateHighchartLink("withDataLabels"));
        add(new UpdateHighchartLink("splineInverted"));
        add(new UpdateHighchartLink("splineWithPlotBands"));
        add(new UpdateHighchartLink("polar"));
        add(new UpdateHighchartLink("percentageArea"));
        add(new UpdateHighchartLink("areaMissing"));
        add(new UpdateHighchartLink("areaInverted"));
        add(new UpdateHighchartLink("areaSpline"));
        add(new UpdateHighchartLink("areaSplineRange"));
        add(new UpdateHighchartLink("basicBar"));
        add(new UpdateHighchartLink("columnWithDrilldown"));
        add(new UpdateHighchartLink("columnRotated"));
        add(new UpdateHighchartLink("stackedBar"));
        add(new UpdateHighchartLink("barNegativeStack"));
        add(new UpdateHighchartLink("basicColumn"));
        add(new UpdateHighchartLink("columnWithNegativeValues"));
        add(new UpdateHighchartLink("stackedColumn"));
        add(new UpdateHighchartLink("stackedArea"));
        add(new UpdateHighchartLink("stackedPercentage"));
        add(new UpdateHighchartLink("basicPie"));
        add(new UpdateHighchartLink("pieWithGradient"));
        add(new UpdateHighchartLink("pieWithLegend"));
        add(new UpdateHighchartLink("bubble"));
        add(new UpdateHighchartLink("3dbubble"));
        add(new UpdateHighchartLink("boxplot"));
        add(new UpdateHighchartLink("angularGauge"));
        add(new UpdateHighchartLink("spiderweb"));
        add(new UpdateHighchartLink("windrose"));
        add(new UpdateHighchartLink("columnrange"));
        add(new UpdateHighchartLink("arearange"));
        add(new UpdateHighchartLink("clicktoadd"));
        add(new UpdateHighchartLink("dualAxes"));
        add(new UpdateHighchartLink("scatterWithRegression"));
        add(new UpdateHighchartLink("multipleAxes"));
        add(new UpdateHighchartLink("errorBar"));
        add(new UpdateHighchartLink("funnel"));
        add(new UpdateHighchartLink("pyramid"));
        add(new UpdateHighchartLink("heatmap"));
    }
211554
def _plot(self):
        """"""
        total = sum(map(sum, map(lambda x: x.values, self.series)))
        if total == 0:
            return
        if self.half_pie:
            current_angle = 3 * pi / 2
        else:
            current_angle = 0

        for index, serie in enumerate(self.series):
            angle = self.slice(serie, current_angle, total)
            current_angle += angle
977677
def add_data_point(self, x, y):
        """"""

        if not is_numeric(x):
            raise TypeError("x value must be numeric, not '%s'" % str(x))
        if not is_numeric(y):
            raise TypeError("y value must be numeric, not '%s'" % str(y))
        current_last_x = self._data[-1][0]
        self._data.append((x, y))
        if x < current_last_x:
            self._data = sorted(self._data, key=lambda k: k[0])
52647
def addSPI(fitsname_alpha=None, fitsname_alpha_error=None, lsmname=None,
           outfile=None,freq0=None, beam=None, spitol=(-10,10)):
    
#    import pylab as plt
    if beam is None:
        raise RuntimeError("the beam option must be specified")

    print "INFO: Getting fits info from: %s, %s" %(fitsname_alpha, fitsname_alpha_error)

    fits_alpha = fitsInfo(fitsname_alpha)    # Get fits info
    image_alpha = fits_alpha['image']     # get image data

    if fitsname_alpha_error:
        fits_alpha_error = fitsInfo(fitsname_alpha_error)
        image_alpha_error = fits_alpha_error['image']
    else:
        fits_alpha_error = fitsInfo(fitsname_alpha)
        image_alpha_error = fits_alpha_error['image']
        image_alpha_error[...] = 1.0

    # may supply FITS file for freq0, in which case just pull ref frequency from FITS file,
    # else explicit frequency, else get frequency from alpha image
    if type(freq0) is str:
        freq0 = fitsInfo(freq0)['freq0']
    else:
        freq0 = freq0 or fits_alpha['freq0']

    model = Tigger.load(lsmname)    # load output sky model
    rad = lambda a: a*(180/np.pi) # convert radians to degrees

    for src in model.sources:
        ra = rad(src.pos.ra)
        dec = rad(src.pos.dec)

        # Cater for point sources and assume source extent equal to the
        # Gaussian major axis along both ra and dec axis
        dra = rad(src.shape.ex) if src.shape  else beam[0]
        ddec = rad(src.shape.ey) if src.shape  else beam[1]
        pa = rad(src.shape.pa) if src.shape  else beam[2]

        emin, emaj = sorted([dra, ddec])
        # Determine region of interest
        rgn = sky2px(fits_alpha["wcs"],ra,dec,dra,ddec,fits_alpha["dra"], beam[1])
        imslice = slice(rgn[2], rgn[3]), slice(rgn[0], rgn[3])
        alpha = image_alpha[imslice]
        xpix, ypix = alpha.shape
        xx, yy = np.ogrid[-xpix:xpix, -ypix:ypix]

        emajPix = emaj/fits_alpha["dra"]
        eminPix = emin/fits_alpha["dra"]
        # Create elliptcal mask which has same shape as source
        mask = ((xx/emajPix)**2 + (yy/eminPix)**2 <= 1)[xpix*2-xpix:xpix*2+xpix, ypix*2-ypix:ypix*2+ypix]
        mask = ndimage.rotate(mask, angle=pa, order=0, reshape=False)
        
        draPix = dra/fits_alpha["dra"]
        ddPix = ddec/fits_alpha["ddec"]

        alpha *= mask
        alpha_error = image_alpha_error[imslice]*mask
        good = np.where( np.logical_and(alpha!=0, alpha!=np.nan))
        alpha = alpha[good]
        alpha_error = alpha_error[good]
        good = np.where( np.logical_and(alpha_error!=np.nan, alpha_error!=np.inf))

        alpha = alpha[good]
        alpha_error = alpha_error[good]

        subIm_weight = 1/alpha_error
        subIm_weighted = alpha*subIm_weight

        if len(subIm_weighted)>0:
            subIm_normalization = np.sum(subIm_weight)
            spi = float(np.sum(subIm_weighted)/subIm_normalization)
            spi_error = 1/float(subIm_normalization)
            if spi > spitol[0] or spi < spitol[-1]:
                sys.stdout.write("INFO: Adding spi: %.3f (at %.3g MHz) to source %s" % (
                                 spi, freq0/1e6, src.name))
                src.spectrum = Tigger.Models.ModelClasses.SpectralIndex(spi, freq0)
                src.setAttribute('spi_error', spi_error)
        else:
            sys.stdout.write("ALERT: no spi info found in %s for source %s" % (
                             fitsname_alpha, src.name))

    model.save(outfile)
825007
def _update_phi(self):
        """"""
        etaprod = 1.0
        for w in range(N_NT - 1):
            self.phi[w] = etaprod * (1 - self.eta[w])
            etaprod *= self.eta[w]
        self.phi[N_NT - 1] = etaprod
1308879
def phi(self):
        
        sum = 0.0
        for grp, contrib in self.phi_components.items():
            sum += contrib
        return sum
866634
def plot (data, pconfig=None):
    
    # Don't just use {} as the default argument as it's mutable. See:
    # http://python-guide-pt-br.readthedocs.io/en/latest/writing/gotchas/
    if pconfig is None:
        pconfig = {}

    # Allow user to overwrite any given config for this plot
    if 'id' in pconfig and pconfig['id'] and pconfig['id'] in config.custom_plot_config:
        for k, v in config.custom_plot_config[pconfig['id']].items():
            pconfig[k] = v

    # Given one dataset - turn it into a list
    if type(data) is not list:
        data = [data]

    # Smooth dataset if requested in config
    if pconfig.get('smooth_points', None) is not None:
        sumcounts = pconfig.get('smooth_points_sumcounts', True)
        for i, d in enumerate(data):
            if type(sumcounts) is list:
                sumc = sumcounts[i]
            else:
                sumc = sumcounts
            data[i] = smooth_line_data(d, pconfig['smooth_points'], sumc)

    # Add sane plotting config defaults
    for idx, yp in enumerate(pconfig.get('yPlotLines', [])):
        pconfig['yPlotLines'][idx]["width"] = pconfig['yPlotLines'][idx].get("width", 2)

    # Add initial axis labels if defined in `data_labels` but not main config
    if pconfig.get('ylab') is None:
        try:
            pconfig['ylab'] = pconfig['data_labels'][0]['ylab']
        except (KeyError, IndexError):
            pass
    if pconfig.get('xlab') is None:
        try:
            pconfig['xlab'] = pconfig['data_labels'][0]['xlab']
        except (KeyError, IndexError):
            pass

    # Generate the data dict structure expected by HighCharts series
    plotdata = list()
    for data_index, d in enumerate(data):
        thisplotdata = list()

        for s in sorted(d.keys()):

            # Ensure any overwritting conditionals from data_labels (e.g. ymax) are taken in consideration
            series_config = pconfig.copy()
            if 'data_labels' in pconfig and type(pconfig['data_labels'][data_index]) is dict:  # if not a dict: only dataset name is provided
                series_config.update(pconfig['data_labels'][data_index])

            pairs = list()
            maxval = 0
            if 'categories' in series_config:
                pconfig['categories'] = list()
                for k in d[s].keys():
                    pconfig['categories'].append(k)
                    pairs.append(d[s][k])
                    maxval = max(maxval, d[s][k])
            else:
                for k in sorted(d[s].keys()):
                    if k is not None:
                        if 'xmax' in series_config and float(k) > float(series_config['xmax']):
                            continue
                        if 'xmin' in series_config and float(k) < float(series_config['xmin']):
                            continue
                    if d[s][k] is not None:
                        if 'ymax' in series_config and float(d[s][k]) > float(series_config['ymax']):
                            continue
                        if 'ymin' in series_config and float(d[s][k]) < float(series_config['ymin']):
                            continue
                    pairs.append([k, d[s][k]])
                    try:
                        maxval = max(maxval, d[s][k])
                    except TypeError:
                        pass
            if maxval > 0 or series_config.get('hide_empty') is not True:
                this_series = { 'name': s, 'data': pairs }
                try:
                    this_series['color'] = series_config['colors'][s]
                except:
                    pass
                thisplotdata.append(this_series)
        plotdata.append(thisplotdata)

    # Add on annotation data series
    try:
        if pconfig.get('extra_series'):
            extra_series = pconfig['extra_series']
            if type(pconfig['extra_series']) == dict:
                extra_series = [[ pconfig['extra_series'] ]]
            elif type(pconfig['extra_series']) == list and type(pconfig['extra_series'][0]) == dict:
                extra_series = [ pconfig['extra_series'] ]
            for i, es in enumerate(extra_series):
                for s in es:
                    plotdata[i].append(s)
    except (KeyError, IndexError):
        pass

    # Make a plot - template custom, or interactive or flat
    try:
        return get_template_mod().linegraph(plotdata, pconfig)
    except (AttributeError, TypeError):
        if config.plots_force_flat or (not config.plots_force_interactive and len(plotdata[0]) > config.plots_flat_numseries):
            try:
                return matplotlib_linegraph(plotdata, pconfig)
            except:
                logger.error("############### Error making MatPlotLib figure! Falling back to HighCharts.")
                return highcharts_linegraph(plotdata, pconfig)
        else:
            # Use MatPlotLib to generate static plots if requested
            if config.export_plots:
                matplotlib_linegraph(plotdata, pconfig)
            # Return HTML for HighCharts dynamic plot
            return highcharts_linegraph(plotdata, pconfig)
588431
def add_series(self, name, number_format=None):
        
        series_data = BubbleSeriesData(self, name, number_format)
        self.append(series_data)
        return series_data
310909
public OHLCSeries addSeries(
      String seriesName, float[] openData, float[] highData, float[] lowData, float[] closeData) {

    return addSeries(seriesName, null, openData, highData, lowData, closeData);
  }
208203
def phi(v):
    
    v = np.atleast_2d(v)
    dir_x = v[:, 0]
    dir_y = v[:, 1]
    return phi_separg(dir_x, dir_y)
48284
def _phi2deriv(self,R,phi=0.,t=0.):
        
        return self._Pot.phi2deriv(R,0.,phi=phi,t=t,use_physical=False)
1161089
public AbstractChart<T, S> addSeries(Serie... series) {
		Collection<Serie> chartSeries = getSeries();
		if (chartSeries == null) {
			chartSeries = new ArrayList<Serie>();
		}
		for (int i = series.length - 1; i >= 0; i--) {
			chartSeries.add(series[i]);
		}
		return this;

	}
354808
public CategorySeries addSeries(
      String seriesName, double[] xData, double[] yData, double[] errorBars) {

    return addSeries(
        seriesName,
        Utils.getNumberListFromDoubleArray(xData),
        Utils.getNumberListFromDoubleArray(yData),
        Utils.getNumberListFromDoubleArray(errorBars));
  }
480117
def _R2deriv(self,R,phi=0.,t=0.):
        
        return self._Pot.R2deriv(R,0.,phi=phi,t=t,use_physical=False)