Surface plot from excel data

8 visualizaciones (últimos 30 días)
Sairaj Ghate
Sairaj Ghate el 13 de Nov. de 2020
Comentada: Ameer Hamza el 13 de Nov. de 2020
Hi there,
Could anyone please help me with plotting 3d surface graph of the attached excel data.

Respuestas (1)

Ameer Hamza
Ameer Hamza el 13 de Nov. de 2020
Editada: Ameer Hamza el 13 de Nov. de 2020
This is one way
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
surf(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;
In case you need to plot lines
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
plot3(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;
grid on
  2 comentarios
Sairaj Ghate
Sairaj Ghate el 13 de Nov. de 2020
Thank you very much.... really apprreciate it.
Ameer Hamza
Ameer Hamza el 13 de Nov. de 2020
I am glad to be of help!!!

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by