Subplot Titles Don't Appear

조회 수: 23 (최근 30일)
Tyler
Tyler 2016년 5월 9일
댓글: Tyler 2016년 5월 9일
Hi, I just have a simple question about subplot titles. I have the following code-
figure
subplot(1,2,1)
[hax1,hline1] = plot....
title('Mean Value')
subplot(1,2,2)
[hax2,hline2] = plot....
title('95% Prediction Interval Range')
When I do this the titles don't show up. Do any of you recognize something I'm overlooking with this?
Thanks!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 5월 9일
t=0:0.1:10;
y=sin(t)
figure
subplot(1,2,1)
hax1 = plot(t,y)
title('Mean Value')
subplot(1,2,2)
hax2= plot(t,2*y)
title('95% Prediction Interval Range')

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 9일
The outputs you show for plot() tell me that you are not using plot(), that instead you are using plotyy() -- plot() does not return the axes but plotyy() does.
My testing in R2016a suggests that after plotyy() calls, the current axes is not changed -- though I did not test the case where you pass an axes in to plotyy() as the first argument.
Anyhow, your code must not be what you show, and what your code actually has might be important for resolving the situation.
The safest thing to do is pass the appropriate axes to title() as the first argument.
title(hax1[1], 'Mean value')
  댓글 수: 1
Tyler
Tyler 2016년 5월 9일
Thank you for your input. Yes, this is not exactly my code, but I use a manually-created plot function, so it would be hard to use that to see the problem without sending you the whole function. It's main purpose is to plot points on a different set of coordinates. The reason I didn't include it is that it normally has worked great in the past. I even dug up an old script where it worked a few months ago and re-tried it, and the titles still do not appear. I'm wondering if maybe there's something wrong with the system?
I did try Azzi's code though and it worked. I also tried your idea of attaching the axis to the title line, but that didn't fix it either...quite the perplexion.

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by