我正在尝试在 php 中绘制高斯图。$x
我找到了 jpgraph 库,但我不知道如何使用$y
数据。请知道如何声明轴的人。谢谢。这是我的代码:
while ($row = pg_fetch_assoc($sql))
{
$ydata = array();
$xdata = array();
$ydata[] = abs(($row['grade']-$miu)/$sigma);
$xdata[] = 0;
for ($i = 0; $i <= 60; $i+=10) // put z value
{
$xdata[] = 0 + $i;
$ydata[] = 0 + $i;
}
$graph = new Graph(600,400,"auto");
$graph->SetScale("linlin");
$lplot = new LinePlot($ydata,$xdata);
$lplot->SetColor("blue");
$lplot->SetWeight(2);
$graph->Add($lplot);
// Add data to X coordinate
$graph->xaxis->SetTickLabels($xdata);
// Display the graph
$graph->Stroke();
}