-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlinepoints1.php
More file actions
64 lines (50 loc) · 1.85 KB
/
linepoints1.php
File metadata and controls
64 lines (50 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
# PHPlot Example: Line-Point plot showing all the point shapes
require_once 'phplot.php';
# This array is used for both the point shapes and legend:
$shapes = array('bowtie', 'box', 'circle', 'cross', 'delta',
'diamond', 'dot', 'down', 'halfline', 'home',
'hourglass', 'line', 'plus', 'rect', 'star',
'target', 'triangle', 'trianglemid', 'up', 'yield');
# Number of shapes defines the number of lines to draw:
$n_shapes = count($shapes);
# Make offset diagonal lines, one for each shape:
$ppl = 6; # Number of points per line.
$data = array();
for ($i = 0; $i < $ppl; $i++) {
$subdata = array('', $i);
$offset = $n_shapes + $ppl - $i - 2;
for ($j = 0; $j < $n_shapes; $j++) $subdata[] = $offset - $j;
$data[] = $subdata;
}
$plot = new phplot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('linepoints');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Linepoints Plot - All Point Shapes');
# Increase X range to make room for the legend.
$plot->SetPlotAreaWorld(0, 0, $ppl, $n_shapes + $ppl - 2);
# Turn off tick labels and ticks - not used for this plot.
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickLabelPos('none');
$plot->SetYTickPos('none');
# Need some different colors;
$plot->SetDataColors(array('orange', 'blue', 'maroon', 'red', 'peru',
'cyan', 'black', 'gold', 'purple', 'YellowGreen',
'SkyBlue', 'green', 'SlateBlue', 'navy', 'aquamarine1',
'violet', 'salmon', 'brown', 'pink', 'DimGrey'));
# Show all shapes:
$plot->SetPointShapes($shapes);
# Make the points bigger so we can see them:
$plot->SetPointSizes(10);
# Make the lines all be solid:
$plot->SetLineStyles('solid');
# Also show that as the legend:
$plot->SetLegend($shapes);
# Draw no grids:
$plot->SetDrawXGrid(False);
$plot->SetDrawYGrid(False);
$plot->DrawGraph();