Display 2D Data in a 3D plot
Show older comments
For a task i need to make 3D-Plot of following Data and compare them in one plot.
Emissions transport (28x1)
Emissions Flug-Schiffsverkehr (28x1)
Years (28x1)
so in one plot ( x = years, y = Data1, z=x) %% I made z=x because i dont know what other data i should use.
other plot ( x = years, y = Data2, z=x)
Has anyone an idea so it makes sense to do this in 3d.
here is my code as far
excel = readmatrix("je-d-02.03.02.03.xlsx")
x = excel(12:39,2)
y = excel(42:69,6)
z = x
y(isnan(y))=0;
[Ux,iax,ixx] = unique(x)
[Uy,iay,ixy] = unique(y)
N = 25 % einstellen
xv = linspace(min(x),max(x),N)
yv = linspace(min(y),max(y),N)
[Xm,Ym] = ndgrid(xv,yv)
Zm = griddata(x, y, z, Xm, Ym)
figure
surfc(Xm, Ym, Zm)
grid on
hold on
xlabel('Jahre')
ylabel('Transport in Mio t')
zlabel('Jahre')
title('3D-Grafik: Gegenüberstellung der Emissionen Transport & Internationaler Luft- und Schiffsverkehr')
legend('Jahre','Transport','Jahre')
%% Zweiter Plot
y2 = excel(72:99,16)
y2(isnan(y2))=0;
[Uy2,iay2,ixy2] = unique(y2)
y2v = linspace(min(y2),max(y2),N)
[Xm,Ym2] = ndgrid(xv,y2v)
Zm2 = griddata(x, y2, z, Xm, Ym2)
surfc(Xm, Ym2, Zm)
2 Comments
Mathieu NOE
on 21 Jun 2023
why don't you simply 2D plot the data (Emissions transport (28x1), Emissions Flug-Schiffsverkehr (28x1)) vs. the years ?
Remo
on 21 Jun 2023
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!