To create a bar plot with two y-axes in MATLAB, you can use the yyaxis function. Here's an example of how to do it:
main.m916 chars33 lines
In the code above, we first create example data for the sum of squared error, adjusted R-squared, and F-statistic values. Then, we pad the data with six zeros to match the number of bars in the figure.
Next, we create a figure and use the yyaxis function to specify that we want two different y-axes. We plot the sum of squared error on the left y-axis using the bar function, and the adjusted R-squared on the right y-axis. Then, we add the F-statistic as additional bars on the right y-axis using the bar function again.
After that, we adjust the y-axis limits and labels using the ylim and yticks functions. Finally, we add the x-axis label and the legend to the plot.
Note that the FaceAlpha is used to adjust the opacity of the bars representing the F-statistic. You can modify this value to achieve the desired visual effect.
gistlibby LogSnag