60 |
jpm |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* This work is hereby released into the Public Domain.
|
|
|
4 |
* To view a copy of the public domain dedication,
|
|
|
5 |
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
|
|
6 |
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
|
|
7 |
*
|
|
|
8 |
*/
|
|
|
9 |
|
|
|
10 |
require_once "../MathPlot.class.php";
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
$graph = new Graph(300, 300);
|
|
|
14 |
|
|
|
15 |
$plot = new MathPlot(-3, 3, 20, -1);
|
|
|
16 |
$plot->setInterval(0.2);
|
|
|
17 |
$plot->setPadding(NULL, NULL, NULL, 20);
|
|
|
18 |
|
|
|
19 |
$plot->yAxis->setLabelInterval(4);
|
|
|
20 |
|
|
|
21 |
$function = new MathFunction('exp');
|
|
|
22 |
$function->setColor(new DarkRed);
|
|
|
23 |
$function->mark->setType(Mark::SQUARE);
|
|
|
24 |
$function->mark->setSize(3);
|
|
|
25 |
$function->mark->setFill(new DarkBlue);
|
|
|
26 |
$plot->add($function, "f(x) = exp(x)", Legend::MARK);
|
|
|
27 |
|
|
|
28 |
$plot->legend->setPosition(0.4, 0.2);
|
|
|
29 |
$plot->legend->setPadding(3, 3, 3, 3, 3);
|
|
|
30 |
|
|
|
31 |
$graph->add($plot);
|
|
|
32 |
$graph->draw();
|
|
|
33 |
?>
|