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!
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!