yline
Add one or more horizontal lines in the current axes or specified axes.
Syntax
h = yline(y)
h = yline(..., property, value, ...)
h = yline(hAxes, ...)
Inputs
- y
- Constant point y of the horizontal line.
- property
- Properties that control the appearance or behavior of the graphics object.
- value
- Value of the properties.
- hAxes
- Axis handle.
Outputs
- h
- Handle of the line graphics object.
Examples
Simple yline example:
clf;
h = yline(2);
Create horizontal lines and set properties example:
clf;
x=[0:0.1:3*pi];
plot(x, sin(x));
h = yline([-1;1],'color','r','linestyle','--');
ylim([-1.5 1.5])
Comments
If there is no axis, one is created first. If y is an Mx1 matrix, then M horizontal lines are created.
If an axis exists, lines are added to it without clearing existing lines.