필터 지우기
필터 지우기

How can I retrieve the size of each tile box (height or width) so that I can place text in the right proportion as the values of each tiledplot vary?

조회 수: 7 (최근 30일)
How can I retrieve the size of each tile box (height or width) so that I can place text in the right proportion with respect the height and width of the plot box as the values of each tiledplot ytick mark or xmark vary and the texts in successive tiles are not in the same position.
Each tile plot has its own velocity range but the plot box is the same height. I wanted to position text in upper left corner with respect a fraction of the axes plot height independent of the magnitude of the velocity values and I was thinking to obtain the height of each tilebox so I can place the text proportionally. Please see image.
text(t(230),(max(absV)-0.04.*((max(absV(:,i_probe,I_file)))-(min(V(:,i_probe,I_file)))),['${\rm{Deceleration}} =$',num2str(sprintf('%.2f',Decceleration_per_height(i_probe))),'$\,\,(m/{s^2})$'],'Color','red', 'FontSize', 10,'Interpreter', 'latex');%, 'BackgroundColor', 'w');

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 12월 28일
If you capture the tiledlayout object, you can query the position of the axes in each tile, with returns the position as [left bottom width height]
t = tiledlayout(2,3)
t =
TiledChartLayout with properties: TileArrangement: 'fixed' GridSize: [2 3] Padding: 'loose' TileSpacing: 'loose' Show all properties
for l = 1:6
nexttile
plot(rand(5))
end
t.Children(1).Position
ans = 1×4
0.6933 0.1100 0.2117 0.3375
t.Children(3).Position
ans = 1×4
0.1300 0.1100 0.2117 0.3375

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by