How do i change name of the x-axes made by plotyy?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Azzi Abdelmalek
am 8 Nov. 2014
Can you provide a short example with numeric data, and explain how months are related to your numbers?
Antworten (1)
Geoff Hayes
am 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).
0 Kommentare
Siehe auch
Kategorien
Mehr zu Two y-axis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!