How to choose specific countries and plot graph?

Here is my dataset
I want to plot multiple countries Confirmed Cases. So how to choose countries and plot a bar graph?

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 6월 28일

0 개 추천

You'll have to get the data into MATLAB first. I suggest using the import tool. This video may be helpful for that.
Once you have the data loaded in a table, this video might help you see how to plot it.

댓글 수: 11

Without using any tool, can you help me with the code?
Use the tool to generate the code you need. This video on generating and reusing code created by the import tool shows you how.
It worked but I want Countries to be x-axis and cases to be y-axis use them to plot Bar-Plot but it's not showing. I want to get cummlative Confirmed Cases for China and plot it as a Bar and same thing for rest countries also. How can I do that?
Cris LaPierre
Cris LaPierre 2020년 6월 29일
편집: Cris LaPierre 2020년 6월 29일
Click the circular arrow icon between your two variables to swap X and Y data.
If you want to create counts by category (country here), you'll need to use the groupsummary function. This video might help you with learning how to use it.
Just an observation. You might consider enrolling in our Exploratory Data Analysis with MATLAB course on Coursera. That is where all these videos are coming from. It is free to enroll if you don't mind skipping the graded content.
I wrote this code instead.
And when I sort it by Desciding Confirmed Cases it doesn't work
I have knowledge of EDA but in Python that's I'm having problem in MATLAB
Cris LaPierre
Cris LaPierre 2020년 6월 29일
편집: Cris LaPierre 2020년 6월 29일
Use the documentation to make sure you get the syntax for sortrows correct for a table.
Thanks, I got my solution. I then sliced the data using this code
top10 = country_clean_sorted(1:10,:);
And now the plot is
Now I suggest looking into the function removecats. It will allow you to remove the categories with zero counts. That can help make the bar plot easier to interpret.
Saurav Karmakar
Saurav Karmakar 2020년 6월 29일
편집: Saurav Karmakar 2020년 6월 29일
What to do?
top10.Country = removecats(top10.Country);
Thanks a lot Cris! I learned a lot today.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Orange에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 6월 28일

댓글:

2020년 6월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by