how to plot graph with color for xy vs z?
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ruthvik sainath meka
le 23 Juil 2019
Commenté : Michael Madelaire
le 23 Juil 2019
I want to plot a graph showing me XY values for perticulur Z value
i want z as a colour
so i will get the data as XY for pertuculur Z
1 commentaire
Réponse acceptée
Michael Madelaire
le 23 Juil 2019
I think you are looking for a scatterplot.
clear all; close all; clc;
x = rand(100,1);
y = rand(100,1);
z = rand(100,1);
figure();
scatter(x,y,20,z);
xlabel('x');
ylabel('y');
c = colorbar;
c.Label.String = 'z';
grid on;
2 commentaires
Michael Madelaire
le 23 Juil 2019
This should do it.
clear all; close all; clc;
x = rand(100, 1);
y = rand(100, 1);
z = rand(100, 1);
[xx, yy] = meshgrid(x, y);
zz = griddata(x, y, z, xx, yy);
figure()
[~, h] = contourf(xx,yy,zz,10);
set(h, 'LineColor', 'none');
xlabel('x');
ylabel('y');
c = colorbar;
c.Label.String = 'z';
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

