MATLAB: How to plot graph with color for xy vs z 3d plotscountours 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 Best Answer 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; Related SolutionsMATLAB: Plotting Values on specific x-y coordinates I think you are asking for contour or contourf functions. Usage is simple;contour(X,Y,Z)orcontourf(X,Y,Z) MATLAB: How to plot 3d line on fit function You need to use hold on. For example,x = rand(100,1);y = rand(100,1);z = x.^2 + y;sf = fit([x, y],z,'poly23')plot(sf); hold on;X=x(10:15)Y=y(10:15)Z=z(10:15)plot3(X,Y,Z,'mo')grid on; Related QuestionPlotting 2D data with respect to a third propertySurf plot using meshgrid
Best Answer