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 Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by