Matlab Commands for Creating Different Plots (part 2)
Hello everyone! I hope y’all are doing well. Today I’m going to go into more detail about Matlab commands that can be used to label plots and change the format. These are commands that aren’t focused on the act of opening figures or plotting data – instead these commands focus on making the plots look pretty.
xlabel(‘name’) – This command provides a label for the x axis of the chart.
ylabel(‘name’) – This command provides a label for the y axis of the chart.
title(‘name’) – This command provides a title for the plot.
Legend(‘name’,’name’,…) – This command provides labels for all the different lines plotted on the graph. It goes in order of the plotting commands as performed – line plot 1 is the first, line plot 2 is the second, etc.
axis([xmin xmax ymin ymax]) – This command specifies a range for the x and y axis. The data is specified in the form of a vector as shown. There are other functions that can be done using the axis command, type ‘help axis’ to see the various functions.
These are the common labeling functions I use on a regular basis. For details on commands that might not have been mentioned here, check out this link. http://tinyurl.com/cb7essb I hope these Matlab posts have been helpful. I’m going to try and find different type topic to talk about next week. Have a good week!
Question of the week: How do you label your Matlab plots? Do you have any preferences in how you do it?