2D color map change the input of y axis

8 views (last 30 days)
I have this script that will compile the data in each file into a 2D color map.
I wanted to change the value of the y axis so that I have the wave number (k) in y axis, instead of wavelength. k=2pi/wavelength
How I might be able to do this?
for i=1:numel(filenames)
t_data(:,i) = lum.y0
angle = linspace(0,0.5,51);
wav_leng = lum.x0.';
imagesc(angle,wav_leng,t_data); colormap turbo; axis xy;
ylabel('Wavelegnth (nm)')

Accepted Answer

Constantino Carlos Reyes-Aldasoro
There are 2 ways to change the values of the y axis, first is to change the values when you plot. I do not have your files so I will use random numbers instead:
axis xy
This simulates your figure, now instead of using [400:900], which is your wav_leng, change it like this:
axis xy
The second would be to change the tick values once you plot. Let me know if this works or if you need the second option.

More Answers (0)


Find more on Colormaps 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!