PHPackages                             sqonk/phext-plotlib - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sqonk/phext-plotlib

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sqonk/phext-plotlib
===================

PlotLib is a wrapper class for the PHP charting library JPGraph for producing charts in bulk.

1.1.6(5mo ago)277612MITPHPPHP ^8CI failing

Since Apr 3Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/sqonk/phext-plotlib)[ Packagist](https://packagist.org/packages/sqonk/phext-plotlib)[ RSS](/packages/sqonk-phext-plotlib/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (20)Used By (2)

PHEXT PlotLib
=============

[](#phext-plotlib)

[![Minimum PHP Version](https://camo.githubusercontent.com/a059fb88d3ff5fe22ed8bf35e3309c8ce74b414e8efe9cf66b7cc7a111ae78b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382d79656c6c6f77)](https://php.net/)[![License](https://camo.githubusercontent.com/e3d584625d5a65f768ca34cf2e2486fe3578f7f9f7f6c1c07548809f8ca8c0f2/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f6c6963656e73652e737667)](license.txt)

PlotLib is a wrapper for the PHP charting library JPGraph. It is designed for quickly outputting basic charts in bulk. Many options can be configured as needed but all have defaults.

The main interface to the library is through the BulkPlot class. While JPGraph supports a multitude of different chart types only a subset are currently supported by BulkPlot. Consider BulkPlot a convenience class that uses assumption to reduce the time required to otherwise build and render a graph.

You should ideally have a general understanding of how [JPGraph](https://jpgraph.net) works in order to get the most out of this library.

You can also combine it with [Visualise](https://github.com/sqonk/phext-visualise) to hook up real-time visual output when working from the command line.

Install
-------

[](#install)

Via Composer

```
$ composer require sqonk/phext-plotlib
```

Documentation
-------------

[](#documentation)

[API Reference](docs/api/index.md) now available here.

Example
-------

[](#example)

```
use sqonk\phext\plotlib\BulkPlot;

$plot = new BulkPlot;

// add a chart with two line plots.
$plot->add('line', [
    	array_map(fn($v) => rand(1, 20), range(1, 10)),
    	array_map(fn($v) => rand(1, 20), range(1, 10))
    ], [
    'title' => 'lines',
    'xseries' => range(1, 10),
    'xformatter' => fn($v) => "Pt $v",
]);

// add a stacked bar chart.
$plot->add('barstacked', [
    	array_map(fn($v) => rand(1, 20), range(1, 10)),
    	array_map(fn($v) => rand(1, 20), range(1, 10))
    ], [
    'title' => 'bars',
    'auxlines' => [
    	['values' => array_map(fn($v) => rand(1, 20), range(1, 10)), 'legend' => 'auxlines']
    ]
]);

$l1 = [19,3,2,7,9,18,4,15,12,13];
$l2 = [17,20,19,17,19,5,13,8,15,8];

// A graph with horizontal and vertical rules.
$plot->add('line', [$l1, $l2], [
    'title' => 'Infinite Lines',
    'xseries' => range(1, 10),
    'font' => [FF_FONT1, FS_NORMAL, 8],
    'lines' => [
        ['direction' => 'h', 'value' => 7, 'color' => 'red'],
        ['direction' => 'v', 'value' => 4, 'color' => 'blue']
    ]
]);

// Finally, a plot with highlighted regions.
$plot->add('line', [$l1], [
    'title' => 'Regions',
    'xseries' => range(1, 10),
    'font' => [FF_FONT1, FS_NORMAL, 8],
    'regions' => [
        ['x' => 3, 'y' => 20, 'x2' => 7, 'y2' => 15, 'color' => 'red@0.3'],
        ['x' => 6, 'y' => 2, 'x2' => 10, 'y2' => 0, 'color' => 'red@0.3']
    ]
]);

// output all charts to a subfolder called 'plotlibtests'.
// this will output two files called 'lines.png' and 'bars.png'.
$plot->output_path('plotlibtests')->render();
```

[![Lines](https://camo.githubusercontent.com/87ed77e3ed18e0f2b72a50815f6358f6e6a7b64c1c3909d378989d210c8c143d/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f6c696e65732e706e67)](https://camo.githubusercontent.com/87ed77e3ed18e0f2b72a50815f6358f6e6a7b64c1c3909d378989d210c8c143d/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f6c696e65732e706e67)

[![Bars](https://camo.githubusercontent.com/1a2f8087879ce7d847eecb367a54b75ab03f0e80105facb2c4575a72bafea6f5/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f626172732e706e67)](https://camo.githubusercontent.com/1a2f8087879ce7d847eecb367a54b75ab03f0e80105facb2c4575a72bafea6f5/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f626172732e706e67)

[![Bars](https://camo.githubusercontent.com/713a16f3861375172e7c8c34f8a42d9591837968b4a37adf1f2e4ca761769e1c/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f696e66696e6974655f6c696e65732e706e67)](https://camo.githubusercontent.com/713a16f3861375172e7c8c34f8a42d9591837968b4a37adf1f2e4ca761769e1c/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f696e66696e6974655f6c696e65732e706e67)

[![Bars](https://camo.githubusercontent.com/cd93e6f835d04c0e5aabd09dc347f1b02c498b1f69454a8958851d2b963e6c73/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f726567696f6e732e706e67)](https://camo.githubusercontent.com/cd93e6f835d04c0e5aabd09dc347f1b02c498b1f69454a8958851d2b963e6c73/68747470733a2f2f73716f6e6b2e636f6d2f6f70656e736f757263652f70686578742f706c6f746c69622f646f63732f696d616765732f726567696f6e732e706e67)

Credits
-------

[](#credits)

Theo Howell

License
-------

[](#license)

**PlotLib** is released under the MIT License (MIT). Please see the [License File](license.txt) for more information. This licence does not extend to the supplied copy of JPGraph, which has its own licensing agreement.

*From the JPGraph package and web site:*

**JpGraph** is released under a dual license. [QPL 1.0 (Qt Free License)](http://www.opensource.org/licenses/qtpl.php) For non-commercial, open-source or educational use and JpGraph Professional License for commercial use. [The professional version](https://jpgraph.net/pro/) also includes additional features and support.

Please see applicable project pages for all external dependancies and their own licensing agreements.

JPGraph
-------

[](#jpgraph)

This library utilises the excellent JPGraph as its charting engine.

Both free and pro versions are available. Please see the [JPGraph](https://jpgraph.net) web site for more information.

The author/maintainer of this project is not associated in any way with the development of JPGraph.

PlotLib bundles and utilises its own copy of JPGraph (currently version 4.4.1) which is compatible with PHP 8.0 and later.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance70

Regular maintenance activity

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~117 days

Recently: every ~302 days

Total

19

Last Release

167d ago

Major Versions

0.5.2 → 1.0.02021-02-03

PHP version history (4 changes)0.3PHP ^7.3

0.4.1PHP ^7.3 || ^8.0.0

0.5PHP ^7.3 || ^7.4 || ^8.0

1.1.0PHP ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/d613b1fb90e5ed5b8207818496ae9c90b7d3b54890803f0af3279c2e7fbd9771?d=identicon)[sqonk](/maintainers/sqonk)

---

Top Contributors

[![sqonk](https://avatars.githubusercontent.com/u/55817417?v=4)](https://github.com/sqonk "sqonk (120 commits)")

---

Tags

chartgraphplot

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sqonk-phext-plotlib/health.svg)

```
[![Health](https://phpackages.com/badges/sqonk-phext-plotlib/health.svg)](https://phpackages.com/packages/sqonk-phext-plotlib)
```

###  Alternatives

[nnnick/chartjs

Simple HTML5 charts using the canvas element.

67.5k1.2M16](/packages/nnnick-chartjs)[novus/nvd3

A reusable charting library written in d3.js

7.2k214.4k3](/packages/novus-nvd3)[amenadiel/jpgraph

Composer Friendly, full refactor of JpGraph, library to make graphs and charts

1532.4M7](/packages/amenadiel-jpgraph)[benpickles/peity

Peity (sounds like deity) is a jQuery plugin that converts an element's content into a mini `&lt;svg&gt;` pie, donut, line or bar chart.

4.2k2.8k](/packages/benpickles-peity)[clue/graph

GraPHP is the mathematical graph/network library written in PHP.

7244.5M43](/packages/clue-graph)[graphp/graph

GraPHP is the mathematical graph/network library written in PHP.

714311.7k5](/packages/graphp-graph)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
