Help plotting two y labels

조회 수: 14 (최근 30일)
lreplo
lreplo 2015년 7월 2일
댓글: lreplo 2015년 7월 9일
I would like to make two y labels that have no data associated with it. I have a line at y=0, and would like to label 0 to inf upwelling while 0 to -inf downwelling on a plot. This is what I have so far...but doesn't help.
dateformat = datestr(dn,'dd-mmm-yyyy');
figure(1)
clf
plot(along, '*')
hline = refline([0 0]);
hline.Color = 'r';
% hold on
% box off
% % Create second Y axes on the right.
% a2 = axes('YAxisLocation', 'Right')
% % Hide second plot.
% set(a2, 'color', 'none')
% set(a2, 'XTick', [])
% % Set scala for second Y.
% set(a2, 'YLim', [-6 2])
xlabel(['Weeks since ' num2str(dateformat(1,:))]);
ylabel('Along shore wind (m/s)')
title(['Along shore wind at ' num2str(closestLat) ' lat, ' num2str(closestLon) ' lon']);
Thanks in advance.

채택된 답변

dpb
dpb 2015년 7월 2일
How about instead of using another axes and futzing with legend
hTx1=text(18,-0.2,'Downwelling','horizontalalign','right','rotation',90,'verticalalign','Top');
hTx2=text(18,0.2,'Upwelling','horizontalalign','left','rotation',90,'verticalalign','Top')
Salt to suit other details, positioning, fonts/sizes, etc., etc., etc., ...
doc text % for details on textproperties
  댓글 수: 1
lreplo
lreplo 2015년 7월 9일
Thank you! That worked perfectly.

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

추가 답변 (0개)

카테고리

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