The technical programming language MATLAB allows you to create complex, presentation-quality graphs. For clarity, it is often preferred to display multiple sets of points on the same axes for comparison. However, by default, many MATLAB functions for plotting data overwrite the graph in the current figure. MATLAB contains a "hold" function, allowing new graphs to be added to a figure on the same set of axes.
- Skill level:
Other People Are Reading
Plot your first set of points using the "plot" function. By default, the plot function plots a 2-D line. Use the "LineStyle" option, setting it to the value "none," and specify the "Marker" to a value other than "none," the default. For example, to plot a set of random points with no line and blue open circle markers:
Prevent MATLAB from overwriting the current figure, using the command "hold on."
Use the "plot" function or other graphing function to add another graph to the current set of axes. Be sure to specify a different marker style to differentiate multiple data sets. To add a second set of points with red squares:
Enter the command "hold off" to return MATLAB to defaults and prevent other graphs from being added to your finished figure.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for