my workspace
named=names(:,1)
covvid=covid_cases(:,end)
[a,ind]=sort(covvid,'descend');
allindexes=length(a):1
bar(a)
set(gca, 'xticklabels', named(ind,:));
i want to plot only first 5 data values how i canmodify this so that it plot only first 5 data

 Akzeptierte Antwort

Jan
Jan am 29 Mai 2021

0 Stimmen

bar(a(1:5))

2 Kommentare

Muhammad
Muhammad am 29 Mai 2021
in x axes how i can plot fist five number of data ,remember that at x axes the data is string ,
Maybe you mean this:
[a, ind] = sort(covid_cases(:, end), 'descend');
bar(a(1:5))
set(gca, 'xticklabels', named(ind(1:5), 1));

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 29 Mai 2021

Kommentiert:

Jan
am 30 Mai 2021

Community Treasure Hunt

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

Start Hunting!

Translated by