To set the axis font size independently in MATLAB without affecting the legend font size, users can utilize the 'FontSize' property specifically for the axes and legends. The command set(gca,'FontSize',20) changes both the axis and legend font sizes simultaneously. To achieve independent control, the legend's font size can be adjusted separately using the command set(legendHandle,'FontSize',desiredSize). This allows for customized font sizes for both the axes and the legend in MATLAB plots. Properly managing these properties enhances the clarity and presentation of graphical data.