Creating Surf() with Labels

后端 未结 1 714
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 07:40
[ndata, text, alldata] = xlsread(\'Euro swap rates.xlsx\',3);
%(although created from text dates is still a cell array?) 
dates=text(:,1);  
%(Same problem here)
rates_h         


        
相关标签:
1条回答
  • 2021-01-29 08:23

    It looks like you want to set the labels on the x-axis.

    You don't do this through surf, you do it after using set, like this:

    set(axHandle, 'XTickLabel', xlabels);
    

    Here is a complete example:

    [x  y] = meshgrid(-4:.25:4;);
    z = x.^2 + y.^2;
    xlab = {'one','two','three','four'};
    
    surf(x,y,z);
    set(gca,'XTickLabel', xlab);
    

    You can use whatever labels you want provided that they are strings and saved to a cell array. This is what I did above for xlab.

    0 讨论(0)
提交回复
热议问题