MATLAB is a technical computing software used by scientists and engineers for data processing and analysis. After analysis is complete, MATLAB offers plotting options to assist in visualising the data. Aside from plotting the data, it is important to properly label a graph to explain what each axis portrays. Labels that can be included within a plot include those for the x and y-axis, a plot title and a legend to match the line colour with the data it represents.
- Skill level:
- Moderately Easy
Other People Are Reading
Clear all active variables within the workspace by entering "clear all" in the Command window.
Generate sample data to plot. Input "x=1:1:20" and "y=rand(1,20)" into the Command window which outputs an array of 20 equally spaced numbers starting at 1 and ending at 20 for the x-axis and an array of 20 randomly generated numbers for the y-data.
Plot the data generated in step 2 by inputting "plot(x, y)" in the Command window.
Select "Show Plot Tools and Dock Figure" under the "Figure" menu.
Click anywhere in the plot window. Under the "Title" box, input the name of the plot. In the "X Axis" menu, input under the "X Label" the name of the x-axis. Do the same for the y-axis by selecting the "Y Axis" menu.
Select each newly created label to change the font of the text.
Insert a legend to the graph by selecting "Insert-Legend" from the "Figure" menu.
Tips and warnings
- Plot labels can also be created within the Command window by inputting "plot(x,y); xlabel('xname'); ylabel('yname');" where "xname" and "yname" are the labels of the x and y-axis, respectively.
- 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