以下是一个使用PHP和GD库绘制XY坐标图的简单实例。在这个例子中,我们将创建一个简单的散点图,其中X轴代表年份,Y轴代表某种度量(例如销售额)。
```php

// 创建一个画布
$width = 400;
$height = 300;
$image = imagecreatetruecolor($width, $height);
// 分配颜色
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
// 填充背景
imagefill($image, 0, 0, $white);
// 设置标题
imagestring($image, 5, 10, 10, "







