increase text size of graph labels in matlab

To increase the text size of graph labels in MATLAB, you can use the "set" function to change the fontsize property of the label object. Here is an example code snippet:

main.m
% create a sample graph and labels
x = 1:5;
y = [2 4 3 1 5];
plot(x, y);
xlabel('X-axis Label');
ylabel('Y-axis Label');

% increase font size to 16 for both labels
set(gca, 'FontSize', 16);
set(get(gca, 'XLabel'), 'FontSize', 16);
set(get(gca, 'YLabel'), 'FontSize', 16);
273 chars
12 lines

The first "set" command changes the fontsize property of the current axes. The second and third "set" commands retrieve the X and Y label objects from the current axes, respectively, and change their fontsize properties to 16. You can adjust the fontsize value to your desired size.

related categories

gistlibby LogSnag