XTickLabelRotation for plotyy in MATLAB 2014bis not working.

조회 수: 3 (최근 30일)
pr
pr 2015년 2월 23일
편집: pr 2015년 2월 23일
I need to plot data with two y-axis with common x-axis [date and time]. And later i would like to rotate the 'XTickLabel' by 60 degrees. Code:
x= [now-.5 now-.3 now];;
y1=[20 35 15];
y2 = [9 10 11];
plotyy(x,y1,x,y2);
datetick('x',31,'keepticks')
h=gca;
h.XTickLabelRotation = 60;
xlabel('Date&Time');
The 'xlabel' and some part of the XTickLabel are hidden. It is working perfectly for 'plot' and if I run the same code for 'plotyy' it is not working. How to solve this issue?
  댓글 수: 1
Sean de Wolski
Sean de Wolski 2015년 2월 23일
Another model example of a well written question!
Clear reproduction steps, a description of the problem, etc.

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 2월 23일
편집: Sean de Wolski 2015년 2월 23일
Plotyy creates two axes on top of each other, one of who's xtick labels is off. Since gca is non-deterministic, you're apparently setting the wrong one. Thus set both of them!
x= [now-.5 now-.3 now];
y1=[20 35 15];
y2 = [9 10 11];
ax = plotyy(x,y1,x,y2);
datetick('x',31,'keepticks')
[ax.XTickLabelRotation] = deal(60);
xlabel('Date&Time');
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2015년 2월 23일
편집: Sean de Wolski 2015년 2월 23일
The tick labels are just too long. Pick a different format, shrink the axes, or choose a different rotation.
pr
pr 2015년 2월 23일
편집: pr 2015년 2월 23일
@ Sean de Wolski: you said that "The tick labels are just too long".I have an another example where x-axis is no more date&time it is a numeric still the same error is reproduced. Look into the attachments. If the rotation is more than 20° it fails.

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

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by