{"id":104,"date":"2004-04-21T09:57:54","date_gmt":"2004-04-21T14:57:54","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=104"},"modified":"2004-04-21T09:57:54","modified_gmt":"2004-04-21T14:57:54","slug":"add-horizontal-and-vertical-lines","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2004\/04\/21\/add-horizontal-and-vertical-lines\/","title":{"rendered":"Add horizontal and vertical lines"},"content":{"rendered":"How many times have you done something like this?\n\n% BEGIN draw a horizontal line\nxMin = 0; xMax = 10; % the current extents of the x axis\nyVal = 12;\n\nhold on\nplot([xMin xMax], [yVal, yVal])\nhold off\n% END draw a horizontal line\n\n<a title=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/loadFile.do?objectId=1039&amp;objectType=file (link no longer works)\">Hline and Vline<\/a> are simple but useful tools that draw a horizontal line at the given Y value from the left most extent of the axes to the right most.  There is a similar command for vertical lines.  You can replace the above with:\n\nhline(yVal)\n\nand be done with it.","protected":false},"excerpt":{"rendered":"<p>How many times have you done something like this?\n\n% BEGIN draw a horizontal line\nxMin = 0; xMax = 10; % the current extents of the x axis\nyVal = 12;\n\nhold on\nplot([xMin xMax], [yVal, yVal])\nhold... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2004\/04\/21\/add-horizontal-and-vertical-lines\/\">read more >><\/a><\/p>","protected":false},"author":68,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/104"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}