Five plots arranged like on dice?
조회 수: 1 (최근 30일)
이전 댓글 표시
How can I arrange five plots in one figure so the plots would be on same positions like points on a dice? I dont want subplot (3,3,...) because of too much empty space. Thanks
댓글 수: 2
dpb
2013년 8월 21일
편집: dpb
2013년 8월 21일
Hmmmm....that now looks completely_different than when I carefully formatted it in the preview pane... :( Including munging on the values. I've no klew how that happend--I'll see if can clean it up.
ADDENDUM--ok the automagic wordwrap struck again -- the formatting all went away simply because I didn't turn the arrangement "figure" into a code block--yet another reason that TMW really, really needs to make that the default instead--having to physically format code in a coding forum just makes no sense at all...one of the reasons I'm scaling back drastically--this sort of what should be needless fixup just takes too much time/effort. :(
ADDENDUM 2: I moved it to Answer since did expand into working code and deleted the comment.
채택된 답변
dpb
2013년 8월 21일
편집: dpb
2013년 8월 21일
Either
a) use subplot(2,3) and rearrange the two middle (make one invisible and move position of the second), or
b) draw them all individually where you want them.
Example for a) (which is what I think I'd do...)
h=zeros(6);
for i=1:6, h(i)=subplot(2,3,i); end % make the six, save handles
delete(h(2)) % wipe out the middle top one
p=get(h(5),'position'); % position of middle bottom
pt=get(h(1),'position'); % position of a upper
p(2)=(pt(2)+p(2))/2; % center of bottom for the two rows
set(h(5),'position',p) % move the middle to there...
h(2)=[]; % remove the nonexistent handle
Just remember that they're numbered sequentially now in position as
1 3 1 2
5 --> 4
4 6 3 5
You can always rearrange the handles in the h vector--swapping h(3) and h(4) would put them from L to R, T to B which probably as easy an ordering as there is, consistent w/ subplot itself.
댓글 수: 0
추가 답변 (1개)
the cyclist
2013년 8월 21일
편집: the cyclist
2013년 8월 21일
Here is a simple, general example of how to position two sets of axes in one figure.
figure
ax1 = axes;
ax2 = axes;
set(ax1,'Position',[0.5 0.5 0.35 0.25])
set(ax2,'Position',[0.1 0.1 0.25 0.35])
h1 = plot(ax1,rand(3,1),rand(3,1),'.');
h2 = plot(ax2,rand(3,1));
You can also adjust the size of the figure window itself with
set(gcf,'Position',<coordinates here>)
Enjoy.
댓글 수: 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!