Help plotting two y labels

11 Ansichten (letzte 30 Tage)
lreplo
lreplo am 2 Jul. 2015
Kommentiert: lreplo am 9 Jul. 2015
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.

Akzeptierte Antwort

dpb
dpb am 2 Jul. 2015
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 Kommentar
lreplo
lreplo am 9 Jul. 2015
Thank you! That worked perfectly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by