5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines
Prev | Chapter 5. PHPlot Examples | Next

## 5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines

This is a horizontal 'linepoints' plot. In a horizontal plot, the Y (vertical) axis is for the independent values, and the X axis (horizontal) is for the dependent values, so PHPlot is graphing X = F(Y).

This plot has:

- Y axis data labels, which show the values from the label positions in the data array along the Y axis (see SetYDataLabelPos, not used in the example below because the default is to plot labels along the Y axis if they are not empty)

- X data value labels, which show the X value just above each data point (see SetXDataLabelPos)

- Y data label lines, which connect the data points horizontally to the Y axis data labels (see SetDrawYDataLabelLines)

Note: Horizontal linepoints plots were added in PHPlot-6.0.0.

Example 5.48. Horizontal Linepoints Plot with Data Value Labels and Data Lines

    <?php
    # PHPlot Example - Horizontal linepoints plot with Y Data Label Lines
    require_once 'phplot.php';

    $data = array(
                array("SEA\nLEVEL", 0, ''),
                array('100m', 1, 10),
                array('200m', 2, 22),
                array('300m', 3, 30),
                array('400m', 4, 46),
                array('500m', 5, 53),
                array('600m', 6, 65),
                array('700m', 7, 70),
                array('800m', 8, 50),
                array('900m', 9, 35),
            );

    $plot = new PHPlot(800, 600);
    $plot->SetImageBorderType('plain'); // Improves presentation in the manual
    $plot->SetTitle('Wind Speed at Altitude');
    $plot->SetDataType('data-data-yx');
    $plot->SetDataValues($data);
    $plot->SetPlotType('linepoints');
    $plot->SetPlotAreaWorld(0, 0, 100, 10);
    $plot->SetDrawYDataLabelLines(True);
    $plot->SetXTitle('Wind Speed');
    $plot->SetYTitle('Altitude');
    $plot->SetYTickLabelPos('none');
    $plot->SetYTickPos('none');
    $plot->SetXDataLabelPos('plotin');
    $plot->SetDrawXGrid(False);
    $plot->SetDrawYGrid(False);
    $plot->DrawGraph();

Prev | Up | Next
5.47. Example - Pie Chart Start Angle and Direction | Home | 5.49. Example - Horizontal Error Plot