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

6 views (last 30 days)
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 Comment
Azzi Abdelmalek
Azzi Abdelmalek on 8 Nov 2014
Can you provide a short example with numeric data, and explain how months are related to your numbers?

Sign in to comment.

Answers (1)

Geoff Hayes
Geoff Hayes on 8 Nov 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).

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!