필터 지우기
필터 지우기

A function to set common properties for all open figures

조회 수: 20 (최근 30일)
Mary
Mary 2020년 10월 5일
댓글: Walter Roberson 2020년 10월 13일
Hi,
As said in the title, I want to creat a function that imposes the same setting for all open figures. By far, I managed to do:
function SetFigureDefaults
set(findall(gcf,'-property','FontSize'),'FontSize',18)
set(findall(gcf,'-property','LineWidth'),'LineWidth',2)
end
And that works. However, I am struggling with everything related with the text interpreter. I was repeating the following lines for each figure
colorbar('TickLabelInterpreter', 'latex')
set(groot,'defaulttextinterpreter','latex');
set(groot, 'defaultLegendInterpreter','latex');
Now, I want to use them with findall feature. I want that ALL axis ticks and ALL colorbar annotations (ticks and labels) become of latex form. How shall I do that ?
Thanks for your help,
Mary

채택된 답변

Adam Danz
Adam Danz 2020년 10월 5일
h = findall(0, '-property', 'TickLabelInterpreter');
set(h, 'TickLabelInterpreter', 'Latex')
  댓글 수: 19
Adam Danz
Adam Danz 2020년 10월 13일
편집: Adam Danz 2020년 10월 13일
It's gotta be something like that. What's odd is that when a ylabel is assigned to a colorbar, the label's parent is the colorbar but it does not show up as a child of the colorbar nor does findall return the ylabel when searching the colorbar object. Note that by default HandleVisibility for the ylabel is 'on'.
clf()
cb = colorbar();
yl = ylabel(cb, 'cb label');
yl.Parent
% ans =
% ColorBar (cb label) with properties:
%
% Location: 'eastoutside'
% Limits: [0 1]
% FontSize: 9
% Position: [0.83048 0.11048 0.038095 0.81524]
% Units: 'normalized'
%
% Show all properties
cb.Children
% ans =
% 0×0 empty GraphicsPlaceholder array.
findall(cb,'-property','interpreter')
% ans =
% 0×0 empty GraphicsPlaceholder array.
Walter Roberson
Walter Roberson 2020년 10월 13일
I did notice the same thing.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by