you cant directly include() an image file and have php output it as an image for the browser just like html <img src> if you want to have the actual graph show up, try making a file that draws the graph you want and outputs it as an image. for example drawgraph.php and inside that it contains this:
<?php
//INCLUDE CLASS FILE HERE
header ("Content-type: image/png"); #Line added to ensure image displays correctly in browser
$plot = new plot2D();
$plot->setTitle("John's spending habits");
$plot->setDescription("Days of the week", "Dollars spent");
$plot->setGrid();
$plot->addCategory("Food", 0xCC, 0x00, 0x00);
$plot->addItem("Food", "sun\n12/1", 152);
$plot->addItem("Food", "mon\n12/2", 76);
$plot->addItem("Food", "tues\n12/3", 81);
$plot->addCategory("Candy", 0x00, 0xCC, 0x00);
$plot->addItem("Candy", "sun\n12/1", 51);
$plot->addItem("Candy", "mon\n12/2", 127);
$plot->addItem("Candy", "tues\n12/3", 45);
$plot->printGraph();
$plot->destroy();
?>
that is just copied from the class file so of course you will want to change it to whatever code you have to plot your graph.
once you have that done, test it by going to drawgraph.php in your browser and see if it outputs the image properly. if it does you can then call it via image tags on your site where you want the graph to appear. <img src="drawgraph.php">
its also possible to pass along extra parameters, of course you will have to code for it but you can do things like <img src="drawgraph.php?x=$userX&y=$userY">
give that a try and see if it works for you.