I was given MATLAB figure files with four subplots. The last subplot has two y axes, and I need to change the font size of the second y axis. I do not have the original data, only the figure files. How do I do this?
2
votes
1 Answers
3
votes
First let's create a figure similar to what you described, and save it to a FIG file:
for i=1:3
subplot(2,2,i)
plot(rand(10,1))
end
subplot(224), plotyy(1:10, rand(10,1), 1:10, randn(10,1))
hgsave myfigure.fig
Now we load the figure from file, and look for the second axis of PLOTYY. Once we have its handle, we can change any property we want.
hFig = hgload('myfigure.fig');
hAx = findobj(hFig, 'type','axes', '-and', 'YAxisLocation','right');
set(hAx, 'FontSize',16, 'XTick',[])
Just keep in mind that the way PLOTYY works is by creating two superimposed axes, each with its own x/y-labels. That's why I suppress the x-labels for the second when I change the font size, to avoid seeing two sets of labels on top of each other (each in a different font size).
FINDOBJ
). I added an answer showing how – Amro