Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Dual parallel X axis scale

1 Ansicht (letzte 30 Tage)
Doyinsola
Doyinsola am 1 Mai 2024
Geschlossen: Doyinsola am 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');

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by