src/PHPSci/Plot/Plotter.php
private function drawLabels()
    {
        $min_value = CArray::amin($this->data[0]);
        $max_value = CArray::amax($this->data[0]);

        $left = CArray::toArray(
            CArray::linspace($min_value, 0, 5, false)
        );

        $right = CArray::toArray(
            CArray::linspace(0, $max_value, 5)
        );

        # Remove 0 so it don't repeat
        array_shift($right);

        $bottom_values = array_merge(
            $left,
            $right
        );

        $padding = CArray::toArray(
            CArray::linspace($this->grid_padding, $this->gridWidth(), count($bottom_values))
        );

        foreach($bottom_values as $k => $value) {
            $this->addLine(
                $padding[$k] + ($this->grid_padding/2),
                $this->height - $this->grid_padding,
                $padding[$k] + ($this->grid_padding/2),
                $this->height - ($this->grid_padding/1.5)
            );
            $this->addText(
                $value,
                $padding[$k] + ($this->grid_padding/2.5),
                $this->height - ($this->grid_padding/2)
            );
        }



        $min_value = CArray::amin($this->data[1]);
        $max_value = CArray::amax($this->data[1]);

        $side_values = CArray::toArray(
            CArray::linspace($min_value, $max_value, 6, false)
        );

        $padding = CArray::toArray(
            CArray::linspace($this->gridHeight(), $this->grid_padding, count($side_values))
        );


        foreach($side_values as $k => $value) {
            $this->addLine(
                $this->grid_padding,
                $padding[$k] + ($this->grid_padding/2),
                ($this->grid_padding/1.5),
                $padding[$k] + ($this->grid_padding/2)
            );
            $this->addText(
                round($value, 2),
                $this->grid_padding * 0.2,
                $padding[$k] + ($this->grid_padding/2.5)
            );
        }
    }
private function drawLabels()
    {
        $min_value = CArray::amin($this->data[0]);
        $max_value = CArray::amax($this->data[0]);

        $left = CArray::toArray(
            CArray::linspace($min_value, 0, 5, false)
        );

        $right = CArray::toArray(
            CArray::linspace(0, $max_value, 5)
        );

        # Remove 0 so it don't repeat
        array_shift($right);

        $bottom_values = array_merge(
            $left,
            $right
        );

        $padding = CArray::toArray(
            CArray::linspace($this->grid_padding, $this->gridWidth(), count($bottom_values))
        );

        foreach($bottom_values as $k => $value) {
            $this->addLine(
                $padding[$k] + ($this->grid_padding/2),
                $this->height - $this->grid_padding,
                $padding[$k] + ($this->grid_padding/2),
                $this->height - ($this->grid_padding/1.5)
            );
            $this->addText(
                $value,
                $padding[$k] + ($this->grid_padding/2.5),
                $this->height - ($this->grid_padding/2)
            );
        }



        $min_value = CArray::amin($this->data[1]);
        $max_value = CArray::amax($this->data[1]);

        $side_values = CArray::toArray(
            CArray::linspace($min_value, $max_value, 6, false)
        );

        $padding = CArray::toArray(
            CArray::linspace($this->gridHeight(), $this->grid_padding, count($side_values))
        );


        foreach($side_values as $k => $value) {
            $this->addLine(
                $this->grid_padding,
                $padding[$k] + ($this->grid_padding/2),
                ($this->grid_padding/1.5),
                $padding[$k] + ($this->grid_padding/2)
            );
            $this->addText(
                round($value, 2),
                $this->grid_padding * 0.2,
                $padding[$k] + ($this->grid_padding/2.5)
            );
        }
    }
private function drawLabels ( ) { $ min_value = CArray :: amin ( $ this -> data [ 0 ] ) ; $ max_value = CArray :: amax ( $ this -> data [ 0 ] ) ; $ left = CArray :: toArray ( CArray :: linspace ( $ min_value , 0 , 5 , false ) ) ; $ right = CArray :: toArray ( CArray :: linspace ( 0 , $ max_value , 5 ) ) ; # Remove 0 so it don't repeat array_shift ( $ right ) ; $ bottom_values = array_merge ( $ left , $ right ) ; $ padding = CArray :: toArray ( CArray :: linspace ( $ this -> grid_padding , $ this -> gridWidth ( ) , count ( $ bottom_values ) ) ) ; foreach ( $ bottom_values as $ k => $ value ) { $ this -> addLine ( $ padding [ $ k ] + ( $ this -> grid_padding / 2 ) , $ this -> height - $ this -> grid_padding , $ padding [ $ k ] + ( $ this -> grid_padding / 2 ) , $ this -> height - ( $ this -> grid_padding / 1.5 ) ) ; $ this -> addText ( $ value , $ padding [ $ k ] + ( $ this -> grid_padding / 2.5 ) , $ this -> height - ( $ this -> grid_padding / 2 ) ) ; } $ min_value = CArray :: amin ( $ this -> data [ 1 ] ) ; $ max_value = CArray :: amax ( $ this -> data [ 1 ] ) ; $ side_values = CArray :: toArray ( CArray :: linspace ( $ min_value , $ max_value , 6 , false ) ) ; $ padding = CArray :: toArray ( CArray :: linspace ( $ this -> gridHeight ( ) , $ this -> grid_padding , count ( $ side_values ) ) ) ; foreach ( $ side_values as $ k => $ value ) { $ this -> addLine ( $ this -> grid_padding , $ padding [ $ k ] + ( $ this -> grid_padding / 2 ) , ( $ this -> grid_padding / 1.5 ) , $ padding [ $ k ] + ( $ this -> grid_padding / 2 ) ) ; $ this -> addText ( round ( $ value , 2 ) , $ this -> grid_padding * 0.2 , $ padding [ $ k ] + ( $ this -> grid_padding / 2.5 ) ) ; } }
Draw Y Bottom Labels
Draw Y Bottom Labels