Credits | Overview | Plotting Styles | Commands | Terminals |
---|
The 2D plotting style with hsteps renders a horizontal line segment ("step") for each data point. The step may extend to the left, to the right, or to both sides of the point's x-coordinate. Additional keywords control the lines connecting adjacent steps and option area fill between the step and a baseline y value.
Syntax:
plot <data> with hsteps {forward|backward} {baseline|pillars|link|nolink} {{above|below} y=<baseline>} {offset <y-offset>}
2 columns: x y 3 columns: x y width
This plot style requires 2 or 3 columns of data. Additional input columns can be used to provide variable line or fill colors (see rgbcolor variable). The x values of the input data are assumed to be monotonic.
If the width of each step is not explicitly given through a third input column, each segment’s width is calculated so that it abuts the adjacent horizontal segments. A negative value in column 3 will be treated as a request for a full-width step.
The forward and backward keywords can be used to specify the direction in which the horizontal segment extends from the given x coordinate. If neither is specified, the horizontal segment extends on both sides of the given x-value halfway to the x-value of the next adjacent point. However, for the first and last points, where there are no corresponding outer adjacent points, the horizontal segments are extrapolated using distances to the adjacent inner points (see histeps, boxes).
The default (baseline) and pillar variants employ a baseline y value. If not provided in the plot command, the baseline is taken to be y=0. If the plot command uses a fill style, the baseline also serves to delimit one boundary of the fill area. Four style variants are possible.
baseline (default): If there is no gap along x between adjacent steps, they are connected by a vertical line segment between them. This produces a curve like the steps, histeps, or fsteps styles. If there is a gap between steps, usually because the width is less than the point spacing, the connecting line drops to the baseline and continues along it before rising again. This produces a sequence of rectangular pulses.
set xzeroaxis plot $data using 1:2 with hsteps plot $data using 1:2:(0.5) with hsteps
pillar: At each end of each step a vertical line is drawn to the baseline. Note that no horizontal line segments are drawn at the baseline.
plot $data using 1:2 with hsteps pillar plot $data using 1:2:(0.5) with hsteps pillar plot $data using 1:2:(0.5) \ with hsteps pillar above fc "blue", \ $data using 1:2:(0.5) \ with hsteps pillar below fc "red"
nolink: No connecting line is drawn between adjacent steps. Baseline and fill properties are not relevant to this variant.
plot $data using 1:2 with hsteps nolink, \ $data using 1:2 with hsteps nolink forward, \ $data using 1:2 with hsteps nolink backward, \ $data using 1:2 with points pt "|"
link: Adjacent steps steps are connected by a single straight line segment. Depending on the step widths, this line may be diagonal rather than vertical.
Example: The link variant can be superimposed onto the pillar variant to produce a stacked histogram plot in which category boundaries are connected.
set style line 11 lw 2 lc "gray" dt "." set style line 12 lw 2 lc variable plot $data using 1:3:(0.5) ls 11 with hsteps link, \ $data using 1:3:(0.5):1 ls 12 with hsteps pillar fs solid 0.7 border, \ $data using 1:4:(0.5) ls 11 with hsteps link, \ $data using 1:4:(0.5):1 ls 12 with hsteps pillar fs transparent pattern 1 border
Subtopics | ||
---|---|---|