matlabplotmatlab-figurehorizontal-line

How to add a x-axis line to a figure? (matlab)


I want to add a x-axis line at 0 to a Matlab figure so that I can compare my data to see if it is positive or negative when saving the figures to a jpg. What is the best way to do this? I know you can use line() but it just seems cumbersome because you need to specify the x and the y ranges. Is there an easier way?


Solution

  • I don't believe there is a built-in way that is more convenient. I use hline() and vline() from FileExchange, which work like a charm:

    http://www.mathworks.com/matlabcentral/fileexchange/1039