How can I disable the background grid of a text box inside the graph in matlab R2019b?.

조회 수: 8 (최근 30일)
I do not want to disable the grid line of entire graph page, only want to disable the grid line of the background of a text box.

채택된 답변

Roshni Garnayak
Roshni Garnayak 2020년 2월 7일
The default background color of the textbox is set to 'none' which renders it transparent. You can remove the gridlines by changing the 'BackgroundColor' property of the textbox to 'white' or any color you wish. Let t be the textbox object. The following code will change the background color:
t.BackgroundColor = 'white';
Refer to the following link for more details on the properties of a textbox:
  댓글 수: 3
Kristoffer Florvaag-Dybvik
Kristoffer Florvaag-Dybvik 2025년 6월 4일
This works (using annotation with a BackgroundColor)
% Textbox... Must use annotation to hide gridlines behind box
set(gcf,'Units','normalized')
p=get(gca,'position');
L=p(1);B=p(2);W=p(3);H=p(4);
np=[(L+0.1*W),(B+0.5*H),0,0 ]; % np (new position) widt/height automatic when using ...'FitBoxToText','on'...
s={'A string','One more line'};
annotation('textbox',np,'String',s,'FitBoxToText','on','BackgroundColor','w')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by