Info

此问题已关闭。 请重新打开它进行编辑或回答。

Dual parallel X axis scale

1 次查看(过去 30 天)
Doyinsola
Doyinsola 2024-5-1
关闭: Doyinsola 2024-5-2
Hi guys, please help review the script below.
I am making a plot with a dual x-axis (in nm and cm-1). The goal is to make a plot of Intensity vs wavelength in nm but at the same time have the wavelength scale in wavenumber parallel to each other. With my current script, the axes doesn't correspond well, for example: 2500nm correspoonds to 4000 cm-1 but what I got doesn't corresponds to this. See image below.
#script
wavenumber = 1e7 ./ wv11;
figure;
plot(wv11, miroptimized(2:end-1,:)); % Plot intensity vs wavelength
xlabel('Wavelength (nm)');
ylabel('Intensity');
ax2 = axes('Position', get(gca, 'Position')+[0, -0.03, 0, 0], 'Color', 'none', 'YTick', [], 'XAxisLocation', 'bottom', 'XLim', [min(wv11), max(wv11)], 'NextPlot', 'add');
xlabel(ax2, 'Wavenumber (cm^{-1})');
ax2.XLim = [min(wavenumber), max(wavenumber)];
ax2.Position = get(gca, 'Position')+[0, -0.03, 0, 0];
set(gca, 'Box', 'off', 'Color', 'none');
set(ax2, 'Box', 'off');

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by