How can I plot a reverse x-axis on the same graph?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jeah MK
am 26 Jan. 2022
Bearbeitet: KALYAN ACHARJYA
am 26 Jan. 2022
I have x = [0 1 2 3 4 3 2 1 0]; and y = 2*x; how can I plot(x,y) and see the value on x-axis as [0 1 2 3 4 3 2 1 0]?
0 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 26 Jan. 2022
Bearbeitet: KALYAN ACHARJYA
am 26 Jan. 2022
#Convert to strings
x=[0 1 2 3 4 3 2 1 0];
y = 2*x;
plot(y);
data=string(x);
set(gca,'xtick',1:length(x),'xticklabel',data)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!