Often we need to draw a vertical or horizontal line across the plot, to mark the boundaries or min/max value of the function. It’s not obvious at the first glance how to do it, becase the X and Y limits can be different, and also we need to handle zoom commands.
I’m now using the solution, based on
graph2d.constantline which was found here
1 2 3 4 5 6 7
It looks like this, and it also correctly handles zoom in and out commands.
UPD 03.04.2015 Unfortunately this does not work in Matlab 2014b or higher. Try this solution .