how to change figure properties?
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello,
I opened two figures and I gave them names. I would like to change their properties not directly after I created them but a posteriori.
Here is an example of what I try to do:
fig1 = figure;
plot(1:10,1:10,'r+');
fig2 = figure;
plot(1:10,-1:-1:-10,'b+');
set(fig1,'xlabel','position')
But I get the error "The name 'xlabel' is not an accessible property for an instance of class 'figure'."
What should I do to have it working?
Thanks
Guillaume
댓글 수: 0
채택된 답변
Adam
2014년 8월 18일
편집: Adam
2014년 8월 18일
xlabel is a property of the axes, not the figure
(I assume that is enough for you to solve the problem, if not I can expand it!)
댓글 수: 3
Adam
2014년 8월 18일
편집: Adam
2014년 8월 18일
There are a few ways you can do it, but maybe simplest is just something like:
fig1 = figure; axes1 = gca;
plot(1:10,1:10,'r+');
fig2 = figure; axes2 = gca;
plot(1:10,-1:-1:-10,'b+');
set(axes1,'xlabel','position')
I think that should work, though I don't have time right now to test it.
The other way that comes to mind is finding the axes as a child of the figure. but that is more complicated and not necessary when you can just store the axes handle.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!