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
2022 年 11 月 21 日
x =fig.eventsTOP.Event_Type; y = fig.eventsTOP.GroupCount; %
bar(x,y)
2 件のコメント
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
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)
カテゴリ
ヘルプ センター および File Exchange で JSON Format についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!