How to change the x-axis step size?

8 Ansichten (letzte 30 Tage)
N/A
N/A am 24 Jun. 2021
Kommentiert: Star Strider am 17 Sep. 2024
I have this code, everything is fine but I tried to change x-axis step size in order to be 1 instead of 0.5, but it didn't work!
clear;
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
set ( gca, 'xdir', 'reverse' )
yyaxis left
stairs(SF,TOA,'-.')
title('Distance <----')
xlabel('SF')
ylabel('TOA (msec)')
yyaxis right
stairs(SF,R_b,'r')
ylabel('Data Rate (kbps)')
legend('TOA','Data Rate')
grid

Akzeptierte Antwort

Star Strider
Star Strider am 24 Jun. 2021
Add 'XTick' to the set call —
set ( gca, 'xdir', 'reverse', 'XTick',fliplr(SF) )
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
figure
set ( gca, 'xdir', 'reverse', 'XTick',fliplr(SF) )
yyaxis left
stairs(SF,TOA,'-.')
title('Distance <----')
xlabel('SF')
ylabel('TOA (msec)')
yyaxis right
stairs(SF,R_b,'r')
ylabel('Data Rate (kbps)')
legend('TOA','Data Rate')
grid
.
  4 Kommentare
Abdou
Abdou am 17 Sep. 2024
Hi @Star Strider, side question! What's the font you're using in the plot? and how are you specifiying for the whole plot? Thanks
Star Strider
Star Strider am 17 Sep. 2024
The font iis whatever the default font is set in the online version. It seems to be Helvetica.
hf = axes;
% hf.Visible = 'off';
hf.FontName
ans = 'Helvetica'
... how are you specifiying for the whole plot?
I don’t understand what you’re referring to.
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by