banner



How To Change The Digit Of Axis Matlab

Equally shown in this answer, you lot tin create a new axes object with near-zero height, so that it is essentially just the ten-axis. Be enlightened that all actual plots must be done on the commencement axes equally this is the surface area you can run into!

Demo code:

          % Create some plotting information and plot x = 0:0.one:ii*pi;   y = sin(x); % Plot, can specify line attributes (like LineWidth) either  % - inline: plot(10,y,'linewidth',2) % - after: p1 = plot(x,y); p1.LineWidth = 2; plot(ten,y); % Get current axes object (just plotted on) and its position ax1 = gca; axPos = ax1.Position; % Change the position of ax1 to make room for extra axes % format is [left bottom width height], then moving up and making shorter here... ax1.Position = axPos + [0 0.3 0 -0.3]; % Exactly the same as for plots (above), axes LineWidth can be changed inline or after ax1.LineWidth = 2; % Add two more than axes objects, with small multiplier for elevation, and showtime for lesser ax2 = axes('position', (axPos .* [1 1 1 1e-iii]) + [0 0.15 0 0], 'color', 'none', 'linewidth', ii); ax3 = axes('position', (axPos .* [one 1 ane 1e-iii]) + [0 0.00 0 0], 'color', 'none', 'linewidth', 2); % Yous can change the limits of the new axes using XLim ax2.XLim = [0 10]; ax3.XLim = [100 157]; % You lot tin label the axes using XLabel.String ax1.XLabel.String = 'Lambda [nm]'; ax2.XLabel.Cord = 'Velocity [m/s]'; ax3.XLabel.Cord = 'Energy [eV]';                  

Output:

multiple x axes matlab


Edit:
Before the 2014b graphics changes you will need to make a couple of tweaks for getting and setting axes backdrop. The equivalent lawmaking would more heavily use the gear up command, and await something like this:

          10 = 0:0.1:2*pi;   y = sin(x); plot(10,y); ax1 = findobj(gca, 'type', 'axes') axPos = go(ax1, 'Position'); set(ax1, 'Position', axPos + [0 0.iii 0 -0.3]); set(ax1, 'LineWidth', ii); ax2 = axes('position', (axPos .* [1 1 1 1e-iii]) + [0 0.xv 0 0], 'color', 'none', 'linewidth', 2); ax3 = axes('position', (axPos .* [1 one 1 1e-3]) + [0 0.00 0 0], 'color', 'none', 'linewidth', 2); set(ax2, 'xlim', [0 ten]); set up(ax3, 'xlim', [100 157]); axes(ax1); xlabel('Lambda [nm]'); axes(ax2); xlabel('Velocity [m/s]'); axes(ax3); xlabel('Energy [eV]');                  

Source: https://stackoverflow.com/questions/45138747/3-x-axis-in-matlab-plot

Posted by: oliverwharned.blogspot.com

0 Response to "How To Change The Digit Of Axis Matlab"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel