Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Dual parallel X axis scale

1 vue (au cours des 30 derniers jours)
Doyinsola
Doyinsola le 1 Mai 2024
Clôturé : Doyinsola le 2 Mai 2024
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');

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by