Horizontal Line Tool - nickcounts/MDRT GitHub Wiki

Location: MDRT\ApplicationModules\PlottingEngine\plotTools\plotHorizLine.m

The Horizontal Line Tool, plotHorizLine, is a separate GUI that allows for the plotting of horizontal lines as boundaries or markers on any one subplot.

The tool is accessed from within the Advanced Menu and prompts the creation of a GUI as shown below. Within the GUI the user can input the following data:

  • Subplot: The tool can plot lines on individual subplots, in the case of a multiplot graph. If there are no subplots, and instead just one plot, the tool treats this as a single subplot and this can then be selected for line application.
  • Y-Value: The y-value merely represents where on the y-axis the line should be placed.
  • Label: The label is the text value that will appear on the plotted line within the plot window. If the label is left blank, no text will appear in the plot window, and instead the line will be assigned a placeholder name “Line#” to distinguish it within the GUI listbox.
  • Color: The line color options include red, green, black, blue, and yellow.
  • Style: The line style options include solid, dashed, and dotted.

The default setup still requires the user enter a Y-Value and choose a subplot, however the label can be left blank and the line will be red and solid.

Once the user has plotted a line via “Apply”, the line will appear with the designated inputs at the appropriate location. The line label, or placeholder name, will appear in the listbox in the order of creation. If a selection is highlighted within the listbox, this highlights the respective line in the plot to indicate to the user which horizontal line is in question. To delete, the user must then select the proper listbox label and press the “Delete” button within the GUI. This removes the horizontal line from both the plot window and the listbox.

Note, the Horizontal Line Tool, as of now, should be used after all axes limits have been placed. When the line is plotted, it takes the current x-axis limits as its bounds and thus, if the graph were to be shifted along the x-axis, the horizontal line still ends at that original bound.

Currently, the GUI is not capable of repopulating the fields when a line is selected from the listbox. Thus, if a plotted line is selected within the listbox, the line is highlighted in the plot, but the fields within the GUI remain unchanged. The code will print warning displays in the command window when the user inputs the wrong data. If a non-number is submitted to the Y-Value line, the command window will display:

    “Invalid Input Argument.
     Make sure "Value" is a number and "Label" is not a repeat.”.

Similarly, if a label that already exists within the listbox is submitted, the code will return the same warning display in the command window.