How do i change name of the x-axes made by plotyy?

2 visualizaciones (últimos 30 días)
sunny kant
sunny kant el 8 de Nov. de 2014
Respondida: Geoff Hayes el 8 de Nov. de 2014
Hello Sir, How do i change name of the x-axis in plotyy, when it come in form of number, I would try to change into months like Jan, feb,...........dec. i send u code and data also, Please check and tell me.
x=xlsread('E:\Review_Paper\Matlab_review.xlsx');
a=x(:,1);
b=x(:,2);
c=x(:,3);
[AX,H1,H2] = plotyy(a,b,a,c,'bar','plot'); % Plotting axis in both side using data
set(get(AX(1),'Ylabel'),'String','AOD (440 nm)') % title of left y-axis
set(get(AX(2),'Ylabel'),'String','Angstrom Exponent (870 nm)')
xlabel('Months') % Title of x axis
% set(AX,{'ycolor'},{'k';'k'})% Left color of Y-axis is black, right color Y-axis is black ...
  1 comentario
Azzi Abdelmalek
Azzi Abdelmalek el 8 de Nov. de 2014
Can you provide a short example with numeric data, and explain how months are related to your numbers?

Iniciar sesión para comentar.

Respuestas (1)

Geoff Hayes
Geoff Hayes el 8 de Nov. de 2014
Sunny - assuming that there are 12 ticks on your x-axis, you could replace these numbers with strings as
set(AX,'XTicklabel',{'Jan','Feb','Mar','Apr','May','June','July', ...
'August','Sept','Oct','Nov','Dec'}');
Note the use of AX which is returned from your call to plotyy. As well, note how the cell array of months is transposed (see the apostrophe after closing brace of this cell array of month strings).

Categorías

Más información sobre Two y-axis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by