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

2 vues (au cours des 30 derniers jours)
sunny kant
sunny kant le 8 Nov 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 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 8 Nov 2014
Can you provide a short example with numeric data, and explain how months are related to your numbers?

Connectez-vous pour commenter.

Réponses (1)

Geoff Hayes
Geoff Hayes le 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).

Catégories

En savoir plus sur Two y-axis dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by