Help plotting two y labels

11 visualizaciones (últimos 30 días)
lreplo
lreplo el 2 de Jul. de 2015
Comentada: lreplo el 9 de Jul. de 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.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by