This is a 'linepoints' plot (Lines/Points) showing all the point shapes available for 'point' and 'linepoints' plots. In this example, we also use a legend to display a text string for each data set, and change the data colors to get a different color for each point shape. Note that the point shape sizes have been increased to 10 in this example, to make them easier to identify.
Example 5.7. Line/Point Plot, Point Shapes
<?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();
This version of the manual was produced for the
PHPlot Sourceforge project web service site, which requires the logo on each
page.
To download a logo-free copy of the manual, see the
PHPlot project downloads
area.