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;
    }