Plot the waveform

@return resource
551240
public function plot()
    {
        $this->getSamples();
        
        $im = imagecreatetruecolor($this->width, $this->height);
        imagesavealpha($im, true);
        imagefill($im, 0, 0, imagecolorallocatealpha($im, 0, 0, 0, 127));

        $center = ($this->height / 2);
        $scale = ($center / $this->level);
        $color = self::strToColor($im, $this->color);
        
        for ($i = 0, $n = count($this->samples); $i < $n-1; $i += 2) {
            $max = $center + (-1 * $this->samples[$i] * $scale);
            $min = $center + (-1 * $this->samples[$i+1] * $scale);
            
            imageline($im, $i / 2, $min, $i / 2, $max, $color);
        }
        
        if (!empty($this->axis)) {
            imageline($im, 0, $this->height / 2, $this->width, $this->height / 2, self::strToColor($im, $this->axis));
        }
        
        return $im;
    }
395720
function tell()
    {
        if (!$this->_assertUsable())
            throw new \RuntimeException('No resource available; cannot tell position');

        if (false === $r = ftell($this->rHandler))
            throw new \RuntimeException('Unable to determine stream position');

        return $r;
    }
1294808
def display_variogram_model(self):
        """"""
        fig = plt.figure()
        ax = fig.add_subplot(111)
        ax.plot(self.lags, self.semivariance, 'r*')
        ax.plot(self.lags,
                self.variogram_function(self.variogram_model_parameters,
                                        self.lags), 'k-')
        plt.show()
661954
public function getHtml()
    {
        $html = array();
        
        if (count($this->m_trendlines) > 0)
        {
            $this->m_options['trendlines'] = json_decode(json_encode($this->m_trendlines, JSON_FORCE_OBJECT)); 
        }
        
        # debug hacks
        $this->m_options['seriesType'] = 'lines';
        $chartType = "ScatterChart"; # LineChart
        
        $html[] = "var data = google.visualization.arrayToDataTable(" . json_encode($this->m_data, JSON_PRETTY_PRINT) . ");";
        $html[] = "var options = " . json_encode($this->m_options) . ";";
        $html[] = "var chart = new google.visualization." . $chartType . "(document.getElementById('" . $this->m_anchorId . "'));";
        
        if ($this->m_clickHandler != null)
        {
            $html[] = "google.visualization.events.addListener(chart, 'click', " . $this->m_clickHandler . ");";
        }
        
        if ($this->m_selectHandler != null)
        {
            $html[] = "google.visualization.events.addListener(chart, 'select', " . $this->m_selectHandler . ");";
        }
        
        $html[] = "chart.draw(data, options);";
        
        return implode(PHP_EOL, $html);
    }
465723
def plot_data(self):
        """"""
        # Clear the plot before plotting onto it
        self.ax.cla()

        if self.sample is None:
            return

        if self.current_channels is None:
            self.current_channels = self.sample.channel_names[:2]

        channels = self.current_channels
        channels_to_plot = channels[0] if len(channels) == 1 else channels
        self.sample.plot(channels_to_plot, ax=self.ax)

        xaxis = self.ax.get_xaxis()
        yaxis = self.ax.get_yaxis()
        self.xlabel_artist = xaxis.get_label()
        self.ylabel_artist = yaxis.get_label()
        self.xlabel_artist.set_picker(5)
        self.ylabel_artist.set_picker(5)

        self.fig.canvas.draw()
236119
public function getSummaryForDisplay()
	{
		if ( is_string( $this->description ) )
			return $this->description;

		return is_string( $this->callback ) ? $this->callback : 'Closure';
	}
99722
def plot_figures():
    """"""
    rc("figure", figsize=[8.,4.])
    rc("figure.subplot", left=.08, top=.95, right=.98)
    rc("image", cmap="gray")
    seed(1000)

    Q1 = cp.Gamma(2)
    Q2 = cp.Normal(0, Q1)
    Q = cp.J(Q1, Q2)
    #end

    subplot(121)
    s,t = meshgrid(linspace(0,5,200), linspace(-6,6,200))
    contourf(s,t,Q.pdf([s,t]),50)
    xlabel("$q_1$")
    ylabel("$q_2$")
    subplot(122)
    Qr = Q.sample(500)
    scatter(*Qr, s=10, c="k", marker="s")
    xlabel("$Q_1$")
    ylabel("$Q_2$")
    axis([0,5,-6,6])

    savefig("multivariate.png"); clf()

    Q2 = cp.Gamma(1)
    Q1 = cp.Normal(Q2**2, Q2+1)
    Q = cp.J(Q1, Q2)
    #end

    subplot(121)
    s,t = meshgrid(linspace(-4,7,200), linspace(0,3,200))
    contourf(s,t,Q.pdf([s,t]),30)
    xlabel("$q_1$")
    ylabel("$q_2$")
    subplot(122)
    Qr = Q.sample(500)
    scatter(*Qr)
    xlabel("$Q_1$")
    ylabel("$Q_2$")
    axis([-4,7,0,3])

    savefig("multivariate2.png"); clf()
1350834
def plot_final(self, ax):
        '''
        

        '''

        # Plot the light curve
        bnmask = np.array(
            list(set(np.concatenate([self.badmask, self.nanmask]))), dtype=int)

        def M(x): return np.delete(x, bnmask)
        if (self.cadence == 'lc') or (len(self.time) < 4000):
            ax.plot(M(self.time), M(self.flux), ls='none',
                    marker='.', color='k', markersize=2, alpha=0.3)
        else:
            ax.plot(M(self.time), M(self.flux), ls='none', marker='.',
                    color='k', markersize=2, alpha=0.03, zorder=-1)
            ax.set_rasterization_zorder(0)
        # Hack: Plot invisible first and last points to ensure
        # the x axis limits are the
        # same in the other plots, where we also plot outliers!
        ax.plot(self.time[0], np.nanmedian(M(self.flux)), marker='.', alpha=0)
        ax.plot(self.time[-1], np.nanmedian(M(self.flux)), marker='.', alpha=0)

        # Plot the GP (long cadence only)
        if self.cadence == 'lc':
            gp = GP(self.kernel, self.kernel_params, white=False)
            gp.compute(self.apply_mask(self.time),
                       self.apply_mask(self.fraw_err))
            med = np.nanmedian(self.apply_mask(self.flux))
            y, _ = gp.predict(self.apply_mask(self.flux) - med, self.time)
            y += med
            ax.plot(M(self.time), M(y), 'r-', lw=0.5, alpha=0.5)

            # Compute the CDPP of the GP-detrended flux
            self.cdppg = self._mission.CDPP(self.apply_mask(
                self.flux - y + med), cadence=self.cadence)

        else:

            # We're not going to calculate this
            self.cdppg = 0.

        # Appearance
        ax.annotate('Final', xy=(0.98, 0.025), xycoords='axes fraction',
                    ha='right', va='bottom', fontsize=10, alpha=0.5,
                    fontweight='bold')
        ax.margins(0.01, 0.1)

        # Get y lims that bound 99% of the flux
        flux = np.delete(self.flux, bnmask)
        N = int(0.995 * len(flux))
        hi, lo = flux[np.argsort(flux)][[N, -N]]
        fsort = flux[np.argsort(flux)]
        pad = (hi - lo) * 0.1
        ylim = (lo - pad, hi + pad)
        ax.set_ylim(ylim)
        ax.get_yaxis().set_major_formatter(Formatter.Flux)
634406
public function getEvent() {
        if (!$this->isEvent()) {
            return EventEnum::Message;
        }
        // ADD SCAN SUBSCRIBE EVENT
        if ($this->event == EventEnum::Subscribe
            && strpos($this->eventKey, 'qrscene_') === 0) {
            $this->eventKey = Str::firstReplace($this->eventKey, 'qrscene_');
            return EventEnum::ScanSubscribe;
        }
        return $this->event;
    }
111126
private function plotValue($y)
    {
        $rangeMapper = new \sb\Math\RangeMapper(Array(
            $this->axis_offset,
            $this->graph_height - $this->axis_offset
        ), Array($this->max, $this->min));
        return $rangeMapper->convert($y);
    }
998460
def plot(self, figsize=None, ax=None, **kwargs):
        '''
        
        '''
        if ax is None:
            fig, ax = plt.subplots(figsize=figsize)
        ax.set_aspect('equal')
        ax.matshow(self.raster, **kwargs)
        plt.draw()
        return ax
1342856
function DrawXAxis() {
    //Draw Tick and Label for Y axis
    $ylab =$this->FormatYTickLabel($this->x_axis_position);
    if ($this->skip_bottom_tick != 1) {
      $this->DrawVerticalTick($ylab,$this->x_axis_position);
    }

    //Draw X Axis at Y=$x_axis_postion
    ImageLine($this->img,$this->plot_area[0]+1,$this->ytr($this->x_axis_position),
        $this->xtr($this->plot_max_x)-1,$this->ytr($this->x_axis_position),$this->ndx_tick_color);

    //X Ticks and Labels
    if ($this->data_type != 'text-data') { //labels for text-data done at data drawing time for speed.
      $this->DrawHorizontalTicks();
    }
    return true;
  }
130919
def plot_band(plt_in, band_name, rsr_obj, **kwargs):
    """"""
    if 'platform_name_in_legend' in kwargs:
        platform_name_in_legend = kwargs['platform_name_in_legend']
    else:
        platform_name_in_legend = False

    detectors = rsr_obj.rsr[band_name].keys()
    # for det in detectors:
    det = sorted(detectors)[0]
    resp = rsr_obj.rsr[band_name][det]['response']
    wvl = rsr_obj.rsr[band_name][det]['wavelength']

    resp = np.ma.masked_less_equal(resp, minimum_response)
    wvl = np.ma.masked_array(wvl, resp.mask)
    resp.compressed()
    wvl.compressed()

    if platform_name_in_legend:
        plt_in.plot(wvl, resp, label='{platform} - {band}'.format(
            platform=rsr_obj.platform_name, band=band_name))
    else:
        plt_in.plot(wvl, resp, label='{band}'.format(band=band_name))

    return plt_in
576170
def plot(self):
        
        import pylab as p
        p.clf()
        fig = p.figure(1)
        nspw = len(self.gain[0])
        ext = n.ceil(n.sqrt(nspw))  # find best squre plot (simplest)
        for spw in range(len(self.gain[0])):
            ax = fig.add_subplot(ext, ext, spw+1)
            for pol in [0,1]:
                ax.scatter(range(len(self.gain)), n.abs(self.gain.data[:,spw,pol]), color=n.array(['k','y']).take(self.gain.mask[:,spw,pol]), marker=['x','.'][pol])

        fig.show()
133656
public function primeForm() {
		$pcs = new \ianring\PitchClassSet($this->scale);
		$p = $pcs->primeFormRing();
		return $p;
	}
849104
def plot(self, plot_cmd=None, tf=lambda y: y):
        """"""
        if not plot_cmd:
            plot_cmd = self.plot_cmd
        colors = 'bgrcmyk'
        pyplot.hold(False)
        res = self.res

        flatx, flatf = self.flattened()
        minf = np.inf
        for i in flatf:
            minf = min((minf, min(flatf[i])))
        addf = 1e-9 - minf if minf <= 1e-9 else 0
        for i in sorted(res.keys()):  # we plot not all values here
            if isinstance(i, int):
                color = colors[i % len(colors)]
                arx = sorted(res[i].keys())
                plot_cmd(arx, [tf(np.median(res[i][x]) + addf) for x in arx], color + '-')
                pyplot.text(arx[-1], tf(np.median(res[i][arx[-1]])), i)
                pyplot.hold(True)
                plot_cmd(flatx[i], tf(np.array(flatf[i]) + addf), color + 'o')
        pyplot.ylabel('f + ' + str(addf))
        pyplot.draw()
        pyplot.ion()
        pyplot.show()
        # raw_input('press return')
        return self
122120
function () {
            var plotLine = this,
              axis = plotLine.axis,
              horiz = axis.horiz,
              halfPointRange = (axis.pointRange || 0) / 2,
              options = plotLine.options,
              optionsLabel = options.label,
              label = plotLine.label,
              width = options.width,
              to = options.to,
              from = options.from,
              isBand = defined(from) && defined(to),
              value = options.value,
              dashStyle = options.dashStyle,
              svgElem = plotLine.svgElem,
              path = [],
              addEvent,
              eventType,
              xs,
              ys,
              x,
              y,
              color = options.color,
              zIndex = options.zIndex,
              events = options.events,
              attribs = {},
              renderer = axis.chart.renderer;

            // logarithmic conversion
            if (axis.isLog) {
                from = log2lin(from);
                to = log2lin(to);
                value = log2lin(value);
            }

            // plot line
            if (width) {
                path = axis.getPlotLinePath(value, width);
                attribs = {
                    stroke: color,
                    'stroke-width': width
                };
                if (dashStyle) {
                    attribs.dashstyle = dashStyle;
                }
            } else if (isBand) { // plot band

                // keep within plot area
                from = mathMax(from, axis.min - halfPointRange);
                to = mathMin(to, axis.max + halfPointRange);

                path = axis.getPlotBandPath(from, to, options);
                if (color) {
                    attribs.fill = color;
                }
                if (options.borderWidth) {
                    attribs.stroke = options.borderColor;
                    attribs['stroke-width'] = options.borderWidth;
                }
            } else {
                return;
            }
            // zIndex
            if (defined(zIndex)) {
                attribs.zIndex = zIndex;
            }

            // common for lines and bands
            if (svgElem) {
                if (path) {
                    svgElem.animate({
                        d: path
                    }, null, svgElem.onGetPath);
                } else {
                    svgElem.hide();
                    svgElem.onGetPath = function () {
                        svgElem.show();
                    };
                    if (label) {
                        plotLine.label = label = label.destroy();
                    }
                }
            } else if (path && path.length) {
                plotLine.svgElem = svgElem = renderer.path(path)
                  .attr(attribs).add();

                // events
                if (events) {
                    addEvent = function (eventType) {
                        svgElem.on(eventType, function (e) {
                            events[eventType].apply(plotLine, [e]);
                        });
                    };
                    for (eventType in events) {
                        addEvent(eventType);
                    }
                }
            }

            // the plot band/line label
            if (optionsLabel && defined(optionsLabel.text) && path && path.length && axis.width > 0 && axis.height > 0) {
                // apply defaults
                optionsLabel = merge({
                    align: horiz && isBand && 'center',
                    x: horiz ? !isBand && 4 : 10,
                    verticalAlign : !horiz && isBand && 'middle',
                    y: horiz ? isBand ? 16 : 10 : isBand ? 6 : -4,
                    rotation: horiz && !isBand && 90
                }, optionsLabel);

                // add the SVG element
                if (!label) {
                    attribs = {
                        align: optionsLabel.textAlign || optionsLabel.align,
                        rotation: optionsLabel.rotation
                    };
                    if (defined(zIndex)) {
                        attribs.zIndex = zIndex;
                    }
                    plotLine.label = label = renderer.text(
                      optionsLabel.text,
                      0,
                      0,
                      optionsLabel.useHTML
                      )
                      .attr(attribs)
                      .css(optionsLabel.style)
                      .add();
                }

                // get the bounding box and align the label
                // #3000 changed to better handle choice between plotband or plotline
                xs = [path[1], path[4], (isBand ? path[6] : path[1])];
                ys = [path[2], path[5], (isBand ? path[7] : path[2])];
                x = arrayMin(xs);
                y = arrayMin(ys);

                label.align(optionsLabel, false, {
                    x: x,
                    y: y,
                    width: arrayMax(xs) - x,
                    height: arrayMax(ys) - y
                });
                label.show();

            } else if (label) { // move out of sight
                label.hide();
            }

            // chainable
            return plotLine;
        }