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

1 次查看(过去 30 天)
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 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2014-11-8
Can you provide a short example with numeric data, and explain how months are related to your numbers?

请先登录,再进行评论。

回答(1 个)

Geoff Hayes
Geoff Hayes 2014-11-8
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).

类别

Help CenterFile Exchange 中查找有关 Two y-axis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by