Plot shows wrong y-axis labels
Show older comments
I am trying to plot a graph, but my y-axis labels are wrong. I have created an array for this reason: wavelength = linspace(747.067,802.822,1024); and I want to plot from 760 to 790. It looks that image is correct, but y-axis simply prints out all values from the wavelength array in order. x-axis is working properly although I did it in the same way. I don't know why this is happening. My code:
A = dlmread('c13_1.txt',',');
wavelength = linspace(747.067,802.822,1024);
y = linspace (-15,15,256);
h=pcolor( y, wavelength, transpose(A(:,2:1025)));
set(h,'EdgeColor','none'), set(gca,'Ydir','normal'),set(gca,'FontSize',12)
set(gca,'YTickLabel',wavelength);
ylabel('Energy'), xlabel('k-space');
set(gca,'Ydir','reverse');
axis([-15 15 760 790 ])
Also attaching the plot itself:

Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!