Adding space for long ticklabels

조회 수: 12 (최근 30일)
Sebastian Heidenreich
Sebastian Heidenreich 2018년 9월 20일
댓글: jonas 2018년 9월 20일
Hi all,
I am creating a plot to display grouped parameter estimates. This is based on a bar chart where I: 1) define empty ticklabels 2) add text at the position of the ticklabels 3) the issue is that long labels do not fit into the figure window.
Here is the outcome
Any ideas on how to automate this?
Cheers
Sebastian

채택된 답변

jonas
jonas 2018년 9월 20일
편집: jonas 2018년 9월 20일
It's really unnecessary to scale the figure to fit with your text. Better yet, make the figure very large and then crop it when you export your plot. export_fig crops automatically.
Start by setting the units of the figure and axes to centimeters. By doing so, you avoid the rescaling of axes that occurs when you use normalized units and change the figure size. Then increase the width of the figure and move your axes horizontally by the same distance.
Here's an example
figure('units','centimeters')
ax1=axes('yticklabels',{},'units','centimeters');hold on
plot(1)
t=text(-0.65,2,'testtesttesttesttesttest')
FigPos=get(1,'position')
set(1,'position',FigPos+[0 0 10 0])
ax1.Position(1)=ax1.Position(1)+10;
export_fig(1,'-jpg','test')
See attachment for cropped output.
  댓글 수: 2
Sebastian Heidenreich
Sebastian Heidenreich 2018년 9월 20일
Ah great! I know how to automate it based on that! Cheers!!!!
jonas
jonas 2018년 9월 20일
Great! Cheers

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by