0
我試圖在php中繪製高斯圖。我找到了jpgraph庫,但我不知道如何使用$x
,$y
數據。請有人知道如何聲明軸。謝謝。這是我的代碼:高斯圖與jpgraph
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();
}