address a subplot without using the subplot command

3 次查看(过去 30 天)
Hi All, I'm looking for an alternative way of addressing a subplot without using the subplot command. I have a figure with 40 panels that I create in Matlab 2014a/Linux. When I open it in Matlab 2017a/OSX, the axes change color from black to gray (bug #1). To change them back, I tried the obvious:
for i=1:40
subplot(4,10,i)
set(gca,'Xcolor',[0 0 0],'Ycolor',[0 0 0])
end
Unfortunately, every time the loop executes "subplot(4,10,i)" it deletes the contents of the panel (bug #2). So, I'm trying to figure out how to switch between panels without using "subplot" or alternatively how to get the list of axis handles for all the panels. Any help would be much appreciated!

采纳的回答

Jan
Jan 2017-10-4
编辑:Jan 2017-10-4
AxesHList = findobj(FigureH, 'Type', 'axes');
set(AxesHList, 'Xcolor', [0 0 0], 'Ycolor', [0 0 0]);
The behavior of subplot is not a "bug", but intended.
I set the color of the axes to black in my startup.m file:
% Get handle of the graphics root object:
if ([100, 1] * sscanf(version, '%d.', 2) >= 804) % HG2 graphics:
RootH = groot;
else % HG1 graphics:
RootH = 0;
end
set(RootH, 'defaultAxesXColor', [0,0,0], ...
'defaultAxesYColor', [0,0,0], ...
'defaultAxesZColor', [0,0,0]);

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by