Why is there extra data in my graph?

Basically, I have this code.
fig = groupsummary(eventsTOP,"Event_Type","none")
x =fig.Event_Type; y = fig.GroupCount;
bar(x,y)
Where "fig" is a table that I extract from a larger table ("eventsTOP") that is already filtered with the data I want.
The table "fig" has the following data:
Event_Type GroupCount
_________________ __________
Coastal Flood 5
Drought 38
Flash Flood 212
Flood 34
Frost/Freeze 16
Funnel Cloud 4
Hail 35
Heat 30
Heavy Rain 7
High Wind 10
Hurricane 9
Lightning 4
Storm Surge/Tide 14
Strong Wind 4
Thunderstorm Wind 88
Tornado 35
Tropical Storm 48
Wildfire 1
As you can see there are 18 Event_Type, but when it comes to plotting it, this happens.
I have more data than I really want to use, and I don't understand where it comes from if I'm using the fig table as a reference.
I just want to use the 18 data I have.

답변 (1개)

VBBV
VBBV 2022년 11월 21일

0 개 추천

x =fig.eventsTOP.Event_Type; y = fig.eventsTOP.GroupCount; %
bar(x,y)

댓글 수: 2

VBBV
VBBV 2022년 11월 21일
check the above, may be you need to access the table eventsTOP first and then its variables Event_Type and GroupCount
VBBV
VBBV 2022년 11월 21일
편집: VBBV 2022년 11월 21일
or use this option
fig = groupsummary(eventsTOP,["Event_Type","GroupCount"],"none","IncludeEmptyGroups",false) %use this option
x =fig.Event_Type; y = fig.GroupCount;
bar(x,y)

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2022b

질문:

2022년 11월 21일

편집:

2022년 11월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by