Plot 9 parameters for 29 country for 20 years in one curve

3 ビュー (過去 30 日間)
wided hechkel 2020 年 8 月 7 日

Dear,
I want to plot using MATLAB, a curve or 3D plot for this database :
ALB 1996 -0,6215114
ALB 1997 -0,6254301
ALB 1998 -0,62933439
ALB 1999 -0,63335227
ALB 2000 -0,63735683
BGD 1996 2,13048473
BGD 1997 2,11153446
BGD 1998 2,07734031
BGD 1999 2,02275107
BGD 2000 1,95238739
So, I have 3 parameters: 1/ countries 2/ years 3/ values
In the example above i used only few data, but could you please find the total database attached (Excel File) I worked on 9 parameters, 29 countries, and 20 years, I want to obtain 9 plots, so for each parameter i have a plot.

サインインしてコメントする。

採用された回答

Sudheer Bhimireddy 2020 年 8 月 8 日

You can try something like this:
% Read data from one sheet
temp = data(:,5);
% Reshape the parameter
temp = reshape(temp.lnide,[29 22]);
% Get the country names and years
countries = unique(data.payscode);
countries = cell2mat(countries);
years = unique(data.Ann_e);
% Plot
h = bar3(temp);
ax = gca;
ax.XTick = 1:3:size(years);
ax.XTickLabel = years(1:3:end);
ax.YTick = 1:3:size(countries);
ax.YTickLabel = countries(1:3:end,:);
to get:
Alternate way is to use plot() with different linestyles and line colors. But that will look messy with 29x20 lines for each parameter.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by