필터 지우기
필터 지우기

Copyobj did not copy attributes/properties

조회 수: 3 (최근 30일)
Luc Masset
Luc Masset 2017년 12월 10일
댓글: Pierre E. 2020년 5월 25일
Hi,
I want to copy existing axes in a new figure using copyobj. Unfortunately, the attributes did not seem to be copied well. Here the font size of new axes xlabel should be 14 and it is 11. Is this the normal behavior?
>> figure
>> hax=gca;
>> set(get(hax,'xlabel'),'fontsize',14,'string','My xlabel')
>> get(get(hax,'xlabel'),'fontsize')
ans =
14
>> fig2=figure;
>> hax2=copyobj(hax,fig2);
>> get(get(hax2,'xlabel'),'fontsize')
ans =
11
Thx,
Luc

답변 (3개)

Jan
Jan 2017년 12월 10일
편집: Jan 2017년 12월 10일
If this is the "normal" behavior or not depends on the definition of "normal": Do you mean the intended or the usual behavior?
  1. I observe the same effect in R2016b, while in R2009a the font size was preserved.
  2. When I copy an axes object, I'd expect, that the font size of the labels is copied.

Luc Masset
Luc Masset 2017년 12월 10일
Hello Jan,
Thx for your answer. Indeed I was thinking of intended/expected behavior. From my point of view too, labels and title attributes should be kept when using copyobj.
Luc

Mack Gardner-Morse
Mack Gardner-Morse 2018년 11월 30일
I agree with Jan. I have the same problem with copyobj in Release 2018a. Both font size and font weight in labels and titles are not preserved using copyobj. I did not see this in much earlier versions of Matlab. Someone should make a bug report.
  댓글 수: 1
Pierre E.
Pierre E. 2020년 5월 25일
Same is observed with release 2019a as well !

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by