geom_hline


Reference line defined by Y intercept. Useful for annotating plots.

Aesthetics

y intercept parameter that control the position of the line
alpha, colour, line type, size classic aesthetics properties

Other Properties

This geometry does not contain other properties.

Similar Geometries

geom_line, geom_vline, geom_abline, geom_path, geom_smooth

Description and Details

Using the described geometry, you can insert a simple geometric object into your data visualization – a line defined by a position on the Y axis. You can find this geometry in the ribbon toolbar tab Layers, under the Primitives button.

Similar to the described geometry, geom_hline is defined. The difference is that, we define the y intercept position parameter. This parameter defines the position of the line on the Y axis. The following figure shows an example where we have defined the position of the horizontal line on the 2.4 coordinate.

Using one geometry layer, you can simultaneously define multiple horizontal lines. If you want to display multiple lines between two coordinates in step 1, you can use the following entry – 2.5:5. This entry means that program generate lines between coordinates 2.5 and 5 in step 1.

In addition to this approach, you can use the selected R function to lines coordinates definition. In the following example, we use the seq function. In this case, we generated horizontal lines between coordinates 2 and 5 in step 0.5.

In addition to the direct definition, you can create lines using mappings on the selected dataset. In the following example, we use the imported dataset, whose structure is defined in following figure.

After linking this dataset with geometry layer, you can use individual variables to map aesthetic properties. The following figure shows an example where we mapped property y intercept to variable y and color aesthetic to id variable.

In the same way, you can define the geom_hline geometry layer.