Download the PHP package macocci7/php-scatterplot without Composer
On this page you can find all versions of the php package macocci7/php-scatterplot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macocci7/php-scatterplot
More information about macocci7/php-scatterplot
Files in macocci7/php-scatterplot
Package php-scatterplot
Short Description it's easy to use for creating scatter plots.
License MIT
Informations about the package php-scatterplot
PHP-Scatterplot
1. Features
PHP-Scatterplot
is a PHP library for creating scatter plots easily.
You can also retrieve parsed data:
Mean
, Variance
, Standard Deviation
, Covariance
,
Correlation Coefficient
and Regression Line Formula
.
Reference Line
and Specification Limits
are supported.
Multiple Layers (Data Sets)
are supported.
Contents
- 1. Features
- 2. Contents
- 3. Requirements
- 4. Installation
- 5. Usage
- 5.1. Basic Usage
- 5.2. Using Layers
- 5.3. Adjusting the Display By Methods
- 5.4. Adjusting the Display By Neon File
- 5.5. Adjusting the Display By Array
- 5.6. Transparent Background
- 5.7. Parsed Data
- 6. Examples
- 7. License
3. Requirements
- PHP 8.1 or later
- Imagick PHP Extension
- Composer
4. Installation
5. Usage
- 5.1. Basic Usage
- 5.2. Using Layers
- 5.3. Adjusting the Display By Methods
- 5.4. Adjusting the Display By Neon File
- 5.5. Adjusting the Display By Array
- 5.6. Transparent Background
- 5.7. Parsed Data
5.1. Basic Usage
-
PHP: examples/BasicUsage.php
-
Result: examples/img/BasicUsage.png
- Details:
- Import Autoloader:
require_once __DIR__ . '/../vendor/autoload.php'
- Declare:
use Macocci7\PhpScatterplot
- Prepare Data:
$layers = [ $layer ]
$layers
:array<int|string, array<string, list<int|float>>>
$layer
:array<string, list<int|float>>
$layer
must have hash keys ofx
andy
.- Hash arrays
x
andy
must have the same number of elements.
- Instantiate:
new Scatterplot()
- Set Data:
layers($layers)
- Create Image:
create($path)
- Import Autoloader:
5.2. Using Layers
-
PHP: examples/UsingLayers.php
-
Result: examples/img/UsingLayers.png
- Details:
- Change Plot Size (Diameter):
plotSize(int $pixSize)
- Set Legend Labels:
legends(string[] $legends)
- Set Label for X Axis:
labelX(string $labelX)
- Set Label for Y Axis:
labelY(string $labelY)
- Set Caption:
caption(string $caption)
- Change Plot Size (Diameter):
5.3. Adjusting the Display By Methods
-
PHP: examples/AdjustDisplayByMethods.php
-
Result: examples/img/AdjustDisplayByMethods.png
- Details:
Available Method limitX(int|float $lower, int|float $upper) limitY(int|float $lower, int|float $upper) resize(int $width, int $height) frame($xRatio, $yRatio) bgcolor(string|null $color = null) axis(int $width, string|null $color = null) grid(int $width, string|null $color = null) gridXPitch(int|float $pitch) gridYPitch(int|float $pitch) colors(array $colors) plotSize(int $size) fontPath(string $path) fontSize(int|float $size) fontColor(string $color) referenceLineX(int|float $x, int $width = 1, string $color = '#0000ff') referenceLineY(int|float $y, int $width = 1, string $color = '#0000ff') specificationLimitX(int|float $lower, int|float $upper, int $width = 1, string $color = '#ff00ff') specificationLimitY(int|float $lower, int|float $upper, int $width = 1, string $color = '#ff00ff') regressionLine(int $width, array $colors) labelX(string $label) labelY(string $label) caption(string $caption) legends(array $legends) gridXOn() gridXOff() gridYOn() gridYOff() referenceLineXOff() referenceLineYOff() referenceLinesOff() specificationLimitXOff() specificationLimitYOff() specificationLimitsOff() regressionLineOn() regressionLineOff() legendOff()
5.4. Adjusting the Display By Neon File
First, prepare a Neon file like this:
- Neon: examples/AdjustDisplayByNeon.neon
Second, Code PHP like this:
- PHP: examples/AdjustDisplayByNeon.php
Then, run the PHP code.
-
Result: examples/img/AdjustDisplayByNeon.png
5.5. Adjusting the Display By Array
-
PHP: examples/AdjustDisplayByArray.php
-
Result: examples/img/AdjustDisplayByArray.png
5.6. Transparent Background
-
PHP: examples/TransparentBackground.php
-
Result: examples/img/TransparentBackground.png
5.7. Parsed Data
-
PHP: examples/ParsedData.php
- Result: examples/ParsedData.txt
6. Examples
- BasicUsage.md
- UsingLayers.md
- AdjustDisplayByMethods.md
-
AdjustDisplayByNeon.php >> results in:
-
AdjustDisplayByArray.php >> results in:
-
TransparentBackground.php >> results in:
- ParsedData.txt
- Matrix.md
7. License
MIT
Document written: 2023/06/06
Document updated: 2024/04/18
Copyright 2023 - 2024 macocci7.
All versions of php-scatterplot with dependencies
intervention/image Version ^3.7
macocci7/php-frequency-table Version ^1.3
macocci7/php-csv Version ^1.0
macocci7/php-combination Version ^1.0
nette/neon Version ^3.4